예제 #1
0
 public override void Fire()
 {
     if (IEnemy.enemys.Count > 0)
     {
         target = BarrageUtil.RandomFecthFromList <IEnemy>(IEnemy.enemys).gameObject;
     }
     base.Fire();
 }
예제 #2
0
파일: Missle.cs 프로젝트: hhhnnnk/Barrage
    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;
    }