示例#1
0
 void ProximityCheck()
 {
     Debug.Log(player);
     player = GameObject.Find("Player").GetComponent <SelfDestruct>();
     if (Vector3.Distance(player.transform.position, transform.position) < 4)
     {
         transform.LookAt(player.transform);
         weapon.Shoot(player.transform, 3);
         player.Execute(2.5f);
     }
 }
示例#2
0
    void Attack(UnitController[] targets, IPlayerControl owner)
    {
        List <Transform> trn = new List <Transform>();

        for (int i = 0; i < targets.Length; i++)
        {
            owner.Damage(targets[i], order[index].damage / targets.Length);
            trn.Add(targets[i].transform);
            Debug.Log(order[index].name + " aims at " + targets[i].name);
        }
        if (trn.Count > 0)
        {
            FireWeapon fire = order[index].GetComponent <FireWeapon>();
            //fire.onDone = ()=>NextCombatant();
            fire.Shoot(trn.ToArray(), 3);

            LeanTween.delayedCall(gameObject, 3, () => NextCombatant());
        }
        else
        {
            NextCombatant();
            Debug.Log(order[index].name + " has no targets in range");
        }
    }
 private void OnShoot()
 {
     muzzleFlash.Play();
     fire.Shoot();
     AudioManager.Instance.PlaySoundEffect(SoundEffect.Shoot);
 }