コード例 #1
0
ファイル: FairyProjectile.cs プロジェクト: cadenkesey/lilith
    /// <summary>
    /// Send the projectile moving towards its target
    /// </summary>
    /// <param name="launcher">The object where the projectile is created</param>
    /// <param name="target">The target for the projectile to hit</param>
    /// <param name="damage">The amount of damage the projectile will do</param>
    public void FireProjectile(GameObject launcher, GameObject target, int damage)
    {
        if (launcher & target)
        {
            _targetDirection = (target.transform.position - launcher.transform.position).normalized;
            _hasFired        = true;

            this.transform.rotation = FairyOperations.TurnTowardPlayer(this.transform, target.transform);

            // Destroy the projectile after it has existed for a certain amount of time
            Destroy(gameObject, 5.0f);
        }
    }
コード例 #2
0
ファイル: AttackState.cs プロジェクト: cadenkesey/lilith
    public override void UpdateState()
    {
        if (EnteredState)
        {
            if (FairyCharacter.PlayerVisible())
            {
                _fireTimer += Time.deltaTime;

                FairyCharacter.transform.rotation = FairyOperations.TurnTowardPlayer(FairyCharacter.transform, FairyCharacter.Player.transform);

                if ((_fireTimer >= _firingRate) && (FairyCharacter.Fire()))
                {
                    FairyCharacter.ChargeAnimationControl.StopChargeAnimation();
                    Fsm.EnterState(FsmStateType.Chase);
                }
            }
            else
            {
                FairyCharacter.ChargeAnimationControl.StopChargeAnimation();
                Fsm.EnterState(FsmStateType.Chase);
            }
        }
    }