Esempio n. 1
0
    void OnCollisionEnter(Collision col)
    {
        GameObject g = col.gameObject;

        if (g.tag == "Projectile")
        {
            GameObject target = GetObjectById(Convert.ToInt32(g.name));
            if (target)
            {
                if (this.name == "ShieldCapsule(Clone)")
                {
                    GameObject gt = (GameObject)Instantiate(
                        sm.ShieldPrefab,
                        target.transform.position,
                        Quaternion.identity);
                    gt.transform.SetParent(target.transform);
                    gt.transform.localScale = Vector3.one * 1.5f;

                    Debug.Log("ijnvoke shireld");
                }
                else
                {
                    MissleCommand tmpg = target.GetComponent <MissleCommand> ();
                    if (tmpg)
                    {
                        tmpg.CooldownTimer = tmpg.CooldownTimer / 10;

                        Debug.Log("ijnvoke spped");
                        StartCoroutine(MC_RC(tmpg));
                    }
                    Enemy tmpe = target.GetComponent <Enemy> ();
                    if (tmpe)
                    {
                        tmpe.CooldownTimer = tmpe.CooldownTimer / 10;
                        Debug.Log("ijnvoke spped");
                        StartCoroutine(EN_RC(tmpe));
                    }
                }
            }

            Destroy(this.gameObject);
        }
    }
Esempio n. 2
0
    IEnumerator MC_RC(MissleCommand mc)
    {
        yield return(new WaitForSeconds(5));

        mc.CooldownTimer = mc.CooldownTimer * 10;
    }