Пример #1
0
 public override void Fire()
 {
     if (IEnemy.enemys.Count > 0)
     {
         target = BarrageUtil.RandomFecthFromList <IEnemy>(IEnemy.enemys).gameObject;
     }
     base.Fire();
 }
Пример #2
0
    public void OnEnable()
    {
        GameObject tmpTrail = Instantiate(trail);

        UnityTool.Attach(gameObject, tmpTrail, Vector3.zero);

        if (IEnemy.enemys.Count > 0)
        {
            target = BarrageUtil.RandomFecthFromList <IEnemy>(IEnemy.enemys).gameObject;
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        if (target == null)
        {
            if (IEnemy.enemys.Count > 0)
            {
                target = BarrageUtil.RandomFecthFromList <IEnemy>(IEnemy.enemys).gameObject;
            }
            base.Update();
            return;
        }

        transform.forward   = Vector3.Slerp(transform.forward, target.transform.position - transform.position, 0.5f / Vector3.Distance(transform.position, target.transform.position));
        transform.position += transform.forward * speed * Time.deltaTime;
    }