//find own ridigbody, the player-object and other scripts
    private void Awake()
    {
        minionRigidbody = GetComponent <Rigidbody>();

        minionControlScript = GetComponent <MinionControl>();

        target             = GameObject.Find("Player").transform;
        playerValuesScript = target.gameObject.GetComponent <PlayerValues>();
    }
Exemplo n.º 2
0
 /// <summary>
 /// minions can collect the loot from the box, save the value and remove the box
 /// </summary>
 /// <param name="other"></param>
 private void OnTriggerEnter(Collider other)
 {
     //call the control script of the colliding minion
     collidingMinion     = other.gameObject;
     minionControlScript = collidingMinion.GetComponent <MinionControl>();
     //transfer gold
     minionControlScript.Looting(amount);
     //destroy the box afterwards, so it can't be collected again
     Destroy(gameObject);
 }
Exemplo n.º 3
0
 public override void Start()
 {
     base.Start();
     minionControl = GetComponent <MinionControl>();
 }