Ejemplo n.º 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();
         }
     }
 }
Ejemplo n.º 2
0
        public void GenerateShadow(StatewithEffect stateEffect, Animator animator, AnimatorStateInfo stateInfo)
        {
            if (animator.IsInTransition(0))
            {
                return;
            }
            GameObject      shadowObj  = PoolManager.Instance.GetObject(PoolObjectType.Shadow);
            PoolObject      shadow     = shadowObj.GetComponent <PoolObject> ();
            MaterialChanger matChanger = shadowObj.GetComponent <MaterialChanger> ();

            CharacterControl player         = stateEffect.CharacterControl;
            Animator         shadowAnimator = shadowObj.GetComponentInChildren <Animator> ();

            shadowObj.SetActive(true);
            matChanger.TurnOffRenderers();

            shadowAnimator.Play(player.CharacterData.GetCurrState(), -1, stateInfo.normalizedTime);
            shadowAnimator.SetFloat(TransitionParameter.SpeedMultiplier.ToString(), 0f);
            shadow.WaitAndDestroy(ShadowDuration);
            matChanger.ChangeTransparency(ShadowDuration);
            shadowObj.transform.position = player.gameObject.transform.position;
            shadowObj.transform.rotation = player.gameObject.transform.rotation;
            matChanger.TurnOnRenderersDelay(0.05f);
        }
Ejemplo n.º 3
0
        public void Dead()
        {
            Debug.Log("grappler dead!");
            //Attacker.Animator.SetBool (TransitionParameter.GrapplingHit.ToString (), false);

            CameraManager.Instance.ResetTrigger();
            CameraManager.Instance.ExitCloseUp(Attacker);
            //Attacker.CharacterData.GrapplingTarget.gameObject.transform.parent = null;
            Target.Animator.SetFloat(TransitionParameter.SpeedMultiplier.ToString(), 1.0f);
            Target.CharacterData.IsGrappled   = false;
            Target.CharacterData.IsInvincible = false;
            Attacker.Animator.SetBool(TransitionParameter.GrapplingHit.ToString(), false);
            IsFinished   = true;
            IsRegistered = false;
            if (AttackManager.Instance.CurrentGrappler.Contains(this))
            {
                AttackManager.Instance.CurrentGrappler.Remove(this);
            }
            PoolObject pobj = gameObject.GetComponent <PoolObject> ();

            PoolManager.Instance.ReturnToPool(pobj);
            this.Clear();
            this.enabled = false;
        }