Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     if (null == prefab)
     {
         Debug.LogError("Please assign the prefab");
     }
     if (null == mc)
     {
         mc = GetComponent <MotionController>();
     }
     mc.Attack += Attacking;
     attr       = GetComponent <AttrController>();
 }
Beispiel #2
0
    public void SetContent(MotionController _mc)
    {
        attrController     = _mc.ac;
        sprite.mainTexture = _mc.ac.icon;

        unitName.text = _mc.ac.unitName;
        mc            = _mc;

        mc.listItem = this;

        mc.ac.Death += Destruct;
        mc.ac.Death += GeneralController.playerMC.GetComponent <PlayerAutomation>().CheckStopAI;
    }
    private void OnTriggerEnter(Collider other)
    {
        //AI, projectiles, editor
        if (other.gameObject.layer == 13 || other.gameObject.layer == 14 || other.gameObject.layer == 8)
        {
            Debug.Log("Passed vision");
            return;
        }

        Debug.LogFormat("Bullt hit {0}, tag = {1}.", other.gameObject.name, other.gameObject.tag);

        if (other.tag == "Unit")
        {
            AttrController attr = other.GetComponent <AttrController>();
            if (!attr.isAlive)
            {
                return;
            }

            MotionController mc = other.GetComponent <MotionController>();
            if (mc)
            {
                if (source && mc.teamIndex == source.teamIndex)
                {
                    return;
                }

                AIController ai = other.GetComponentInChildren <AIController>();
                if (ai)
                {
                    ai.targetList.Add(source);
                }
            }


            attr.TakeDamage(damage);

            NGUI_SplashText.CreateText(transform.position, damage);
        }



        Destroy(gameObject);
    }
Beispiel #4
0
    public void CheckList()
    {
        //remove destroyed objects

        for (int i = 0; i < spawnList.Count; i++)
        {
            if (spawnList[i] == null)
            {
                spawnList.RemoveAt(i);
            }
            else
            {
                AttrController attr = spawnList[i].GetComponent <AttrController>();
                if (attr && !attr.isAlive)
                {
                    Destroy(spawnList[i]);
                    spawnList.RemoveAt(i);
                }
            }
        }
    }
    private void Awake()
    {
        if (null == anim)
        {
            anim = GetComponentInChildren <Animator>();
        }

        if (null == cc)
        {
            cc = GetComponentInChildren <CharacterController>();
        }

        if (null == sc)
        {
            sc = GetComponentInChildren <SoundController>();
        }

        if (null == ac)
        {
            ac = GetComponentInChildren <AttrController>();
        }
    }
Beispiel #6
0
    //[SerializeField] CamControlEZ camAssist;

    public GameObject CreatePlayer()
    {
        GameObject g = Instantiate(playerPrefab, transform.position, Quaternion.identity);

        PlayerEasyToucher.instance.InitEasyTouch(g);
        //camAssist.pivot = GameObject.Find("Pivot").transform;
        //camAssist.player = g.transform;

        cam.pivot  = g.GetComponentInChildren <PivotMarker>().transform;
        cam.player = g.transform;
        cam.Init();

        GeneralController.playerMC = g.GetComponent <MotionController>();



        AttrController playerAttr = g.GetComponent <AttrController>();

        playerAttr.Death += DelayedSpawn;
        playerAttr.bar    = playerBar;
        //playerBar.
        return(g);
    }
Beispiel #7
0
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Unit")
        {
            AttrController attr = other.GetComponent <AttrController>();
            if (!attr.isAlive)
            {
                return;
            }

            attr.TakeDamage(main.DPS * Time.deltaTime);

            AIController ai = other.GetComponentInChildren <AIController>();
            if (ai)
            {
                ai.targetList.Add(source);
            }

            if (0 == textCD)
            {
                NGUI_SplashText.CreateText(other.transform.position + 0.5f * Vector3.up, main.DPS * (Time.deltaTime * textCycle));
            }
        }
    }
Beispiel #8
0
 void Awake()
 {
     instance = this;
 }
Beispiel #9
0
 void Awake()
 {
     instance = this;
 }
Beispiel #10
0
 private void Start()
 {
     m_Attr = AttrController.Instance;
 }
Beispiel #11
0
 private void Start()
 {
     Instance = this;
 }