Example #1
0
 void Awake()
 {
     _body    = GetComponent <MovableBody>();
     _diver   = GetComponent <DiveDamager>();
     _carrier = GetComponent <Carrier>();
     _health  = GetComponent <Health>();
 }
 public void Charge(OnPointTargetCastEventData e)
 {
     //such that the skill cannot be cast again if already in motion
     if (!IsCharging)
     {
         Caster       = e.Caster;
         ColorShifter = Caster.GetComponentInChildren <ColorShifter>();
         if (ColorShifter == null)
         {
             Debug.LogWarning("No `ColorShifter` shifter component found when attempting to use charge skill");
         }
         MovableBody = Caster.GetComponentInChildren <MovableBody>();
         if (MovableBody == null)
         {
             throw new MissingComponentException(
                       "No `MovableBody` component found on caster when attempting to use charge skill"
                       );
         }
         Target = e.Target;
         Origin = e.Caster.transform.position;
         StartCharging(
             e.Stats.GetValue("ChargeDuration") + 0.33f,
             e.Stats.GetValue("ChargeBonusSpeed") + 2f,
             e.Stats.GetValue("ChargeBonusAcceleration") + 10f
             );
     }
 }
Example #3
0
    public void EndConfusion(OnStatusEndEventData e)
    {
        MovableBody movableBody =
            e.Target.GetComponentInChildren <MovableBody>();

        if (movableBody != null)
        {
            RemoveLastRandomMovement(movableBody);
        }
        StatusCollection Collection =
            e.Target.GetComponentInChildren <StatusCollection>();

        if (Collection != null)
        {
            Collection.RemoveStatus(Status);
        }
        ColorShifter shifter =
            e.Target.GetComponentInChildren <ColorShifter>();

        if (shifter != null)
        {
            shifter.ShiftToColor(
                new Color(1f, 1f, 0f, 1f),
                new Color(1f, 1f, 1f, 1f),
                1f
                );
            StartCoroutine(DestroyAfter(1f));
        }
        else
        {
            Destroy(gameObject);
        }
    }
Example #4
0
 private void RemoveLastRandomMovement(MovableBody movableBody)
 {
     movableBody.RemoveFromDirection(
         LastAddedMovement,
         LastAddedMovementMagnitude
         );
 }
Example #5
0
 void Awake()
 {
     _body       = GetComponent <MovableBody>();
     _carrier    = GetComponentInChildren <Carrier>();
     _diver      = GetComponentInChildren <DiveDamager>();
     _health     = GetComponent <Health>();
     _flyControl = GetComponent <FlyControl>();
 }
 // Use this for initialization
 void Awake()
 {
     _state      = GetComponent <DuckState>();
     _health     = GetComponent <Health>();
     _data       = _state.Data;
     _carrier    = GetComponentInChildren <Carrier>();
     _blast      = GetComponentInChildren <Blast>();
     _body       = GetComponent <MovableBody>();
     _flyControl = GetComponent <FlyControl>();
 }
 private void Awake()
 {
     _view       = GetComponent <PlayerView>();
     _state      = GetComponent <DuckState>();
     _health     = GetComponent <Health>();
     _diver      = GetComponent <DiveDamager>();
     _body       = GetComponent <MovableBody>();
     _carrier    = GetComponent <Carrier>();
     _flyControl = GetComponent <FlyControl>();
 }
Example #8
0
 private void AddRandomMovement(MovableBody movableBody)
 {
     LastAddedMovementMagnitude = Dice.Roll(0.5f, 2f);
     LastAddedMovement          = new Vector3(
         Dice.Roll(-1f, 1f),
         0f,
         Dice.Roll(-1f, 1f)
         );
     movableBody.AddToDirection(
         LastAddedMovement,
         LastAddedMovementMagnitude
         );
 }
Example #9
0
    public void TickConfusion(OnStatusTickEventData e)
    {
        MovableBody movableBody =
            e.Target.GetComponentInChildren <MovableBody>();

        if (movableBody != null)
        {
            RemoveLastRandomMovement(movableBody);
            AddRandomMovement(movableBody);
        }
        if (cTimer < e.Duration)
        {
            StartCoroutine(RetickAfter(0.1f, e));
        }
        else
        {
            Emitter.Emit(
                new OnStatusEndEventData(e.Target)
                );
        }
    }
Example #10
0
    public void Body_Moving(MovableBody body)
    {
        if (IsDead)
        {
            return;
        }
        var dt       = Time.fixedDeltaTime;
        var velocity = body.Velocity;
        var vyMax    = Data.GetMoveVerMax(_diver.IsActive);
        var ay       = -GetGravity();
        var targetVx = GetTargetVelocityX();
        var hacc     = GetHorizontalAcceleration();

        velocity.x = XMath.AddByMod(velocity.x, targetVx, hacc * dt);
        velocity.y = GetVelocityY(dt, ay, velocity.y);
        if (velocity.y > vyMax)
        {
            velocity.y = vyMax;
        }

        body.Velocity = velocity;
    }
Example #11
0
 // Use this for initialization
 void Awake()
 {
     _body = GetComponent <MovableBody>();
 }