Exemple #1
0
    void ApplySlow(Collider mob)
    {
        Debug.Log("Slowing mob:");

        if (mob.transform.parent.GetComponent <PlayerController> () != null)          //player
        {
            pc = mob.transform.parent.GetComponent <PlayerController> ();
            if (initialSpeed == 0f)
            {
                initialSpeed = pc.speed;
            }
            pc.speed = initialSpeed * (slow / 100f);
        }
        else if (mob.GetComponent <NeutralMobMovement> () != null)            //neutral mob
        {
            nmm = mob.GetComponent <NeutralMobMovement> ();
            if (initialSpeed == 0f)
            {
                initialSpeed = nmm.speed;
            }
            nmm.speed = initialSpeed * (slow / 100f);
        }
        else
        {
            return;
        }
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     if ((pc = GetComponent <PlayerController> ()) != null)          // owner is player
     {
         isPlayer = true;
     }
     else if ((nmm = GetComponent <NeutralMobMovement> ()) != null)          //owner is neutral mob
     {
         isPlayer = false;
     }
     else if ((hmm = GetComponent <HostileMobMovement> ()) != null)          //owner is hostile mob
     {
         isPlayer = false;
     }
 }