53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System;
|
|
using Boo.Lang.Runtime;
|
|
using UnityEngine;
|
|
using UnityScript.Lang;
|
|
|
|
[Serializable]
|
|
public class Individualize : MonoBehaviour
|
|
{
|
|
public string entID;
|
|
|
|
public virtual void Start()
|
|
{
|
|
entID = gameObject.GetComponent<NetworkView>().viewID.ToString().Remove(0, 13);
|
|
if (GetComponent<NetworkView>().isMine)
|
|
{
|
|
GetComponent<NetworkView>().RPC("Change", RPCMode.AllBuffered, entID);
|
|
}
|
|
}
|
|
|
|
[RPC]
|
|
public virtual void Change(string ent)
|
|
{
|
|
if (!(gameObject.GetComponent<NetworkView>().viewID.ToString().Remove(0, 13) == ent))
|
|
{
|
|
return;
|
|
}
|
|
Component[] componentsInChildren = GetComponentsInChildren(typeof(Transform));
|
|
int i = 0;
|
|
Component[] array = componentsInChildren;
|
|
for (int length = array.Length; i < length; i++)
|
|
{
|
|
if (array[i].tag == "Player")
|
|
{
|
|
array[i].name = array[i].name + ent;
|
|
}
|
|
}
|
|
Component[] componentsInChildren2 = GetComponentsInChildren(typeof(Renderer));
|
|
int j = 0;
|
|
Component[] array2 = componentsInChildren2;
|
|
for (int length2 = array2.Length; j < length2; j++)
|
|
{
|
|
for (int k = 0; RuntimeServices.ToBool(RuntimeServices.InvokeBinaryOperator("op_LessThan", k, UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(array2[j], "materials"), "length"))); k++)
|
|
{
|
|
RuntimeServices.SetProperty(RuntimeServices.GetSlice(array2[j], "materials", new object[1] { k }), "name", RuntimeServices.InvokeBinaryOperator("op_Addition", UnityRuntimeServices.GetProperty(RuntimeServices.GetSlice(array2[j], "materials", new object[1] { k }), "name"), ent));
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual void Main()
|
|
{
|
|
}
|
|
}
|