Пример #1
0
    public void GetFriendsAndFoes()
    {
        TeamHandler th = GameObject.FindGameObjectWithTag("TeamHandler").gameObject.GetComponent <TeamHandler>();

        th.GetFriendsAndFoes(LayerMask.LayerToName(this.transform.gameObject.layer), ref friendlyLayers, ref enemyLayers);
        InitializeLayerMask();
    }
Пример #2
0
    public virtual void InitAbility(Transform caster)
    {
        if (initTimes > 0)
        {
            return;
        }
        thisTransform = this.transform;
        casterT       = caster;
        casterIDName  = casterT.name + casterT.GetComponent <AIBase>().id.ToString();

        if (teamHandler == null) //så den inte behöver hämtas flera gånger
        {
            teamHandler = GameObject.FindGameObjectWithTag("TeamHandler").GetComponent <TeamHandler>();
        }

        eLayers = new string[0];
        fLayers = new List <string>();
        teamHandler.GetFriendsAndFoes(LayerMask.LayerToName(caster.gameObject.layer), ref fLayers, ref eLayers);

        for (int i = 0; i < eLayers.Length; i++)
        {
            enemyLayermask |= (1 << LayerMask.NameToLayer(eLayers[i]));
        }

        for (int i = 0; i < fLayers.Count; i++)
        {
            friendlyLayermask |= (1 << LayerMask.NameToLayer(fLayers[i]));
        }

        ApplyToolTipValues();
        initTimes++;
    }