Example #1
0
 void FixedUpdate()
 {
     if (IsMoving && !ProjectileInfo.IsFinished && CurrentTime < Duration)
     {
         //Debug.DrawRay(transform.position, transform.forward, Color.red);
         if (Speed > 0f)
         {
             transform.Translate(transform.forward * Speed * SpeedGraph.Evaluate(CurrentTime / Duration) * Time.fixedDeltaTime, Space.World);
         }
         ProjectileInfo.transform.localScale = Vector3.one * ScaleGraph.Evaluate(CurrentTime / Duration) * ProjectileScale;
         if (IsVFXScaleChangeWithScaling)
         {
             ParticleSystem[] pss = GetComponentsInChildren <ParticleSystem> ();
             foreach (ParticleSystem ps in pss)
             {
                 ps.gameObject.transform.localScale = Vector3.one * ScaleGraph.Evaluate(CurrentTime / Duration) * ProjectileScale;
             }
         }
         CurrentTime         += Time.fixedDeltaTime;
         CurrentTimeToDamage += Time.fixedDeltaTime;
         if (CurrentTimeToDamage > ProjectileInfo.DamageInterval)
         {
             ProjectileInfo.Targets.Clear();
             ProjectileInfo.CurrentTargetNum = 0;
             CurrentTimeToDamage             = 0f;
         }
     }
     else
     {
         Dead();
         if (AttackManager.Instance.CurrentAttackInfo.Contains(ProjectileInfo))
         {
             AttackManager.Instance.CurrentAttackInfo.Remove(ProjectileInfo);
             PoolObject infoObj = ProjectileInfo.GetComponent <PoolObject> ();
             PoolManager.Instance.ReturnToPool(infoObj);
             ProjectileInfo.Clear();
         }
     }
 }