示例#1
0
    private void Start()
    {
        thisMissile = GetComponent <Missile>();
        // rigidbody = GetComponent<Rigidbody>();
        Networker.MissileUpdate += MissileUpdate;
        thisMissile.OnDetonate.AddListener(new UnityEngine.Events.UnityAction(() => { Debug.Log("Missile detonated: " + thisMissile.name); }));
        if (thisMissile.guidanceMode == Missile.GuidanceModes.Bomb)
        {
            foreach (var collider in thisMissile.GetComponentsInChildren <Collider>())
            {
                collider.gameObject.layer = 9;
            }
        }

        if (thisMissile.guidanceMode == Missile.GuidanceModes.Optical)
        {
            foreach (var collider in thisMissile.GetComponentsInChildren <Collider>())
            {
                collider.gameObject.layer = 9;
            }
        }

        thisMissile.explodeRadius *= 1.8f; thisMissile.explodeDamage *= 0.75f;
        traverse = Traverse.Create(thisML);
        traverse.Field("detonated").SetValue(true);
    }