Exemplo n.º 1
0
    void RestorSpeedFunction()
    {
        PathTroughObject scriptInstance = gameObject.transform.parent.GetComponent <PathTroughObject>();

        scriptInstance.speed = originalSpeed;
        Destroy(gameObject);
    }
Exemplo n.º 2
0
    void OnCollisionEnter(Collision col)
    {
        if (col.collider.tag == "Enemy")
        {
            col.collider.SendMessage("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);

            if (col.collider.GetComponentInChildren <RestoreSpeed>() == null)
            {
                PathTroughObject scriptInstance = col.collider.GetComponent <PathTroughObject>();


                GameObject restoreSpeedIntsnce = Instantiate(restoreSoeedObhect, col.collider.transform.position, Quaternion.identity) as GameObject;
                restoreSpeedIntsnce.transform.parent = col.collider.transform;
                RestoreSpeed scriptInstance2 = restoreSpeedIntsnce.GetComponent <RestoreSpeed>();
                scriptInstance2.time          = slowSpeed;
                scriptInstance2.originalSpeed = scriptInstance.speed;

                scriptInstance.speed *= slowPercentage;
            }
            Destroy(gameObject);
        }
    }