Esempio n. 1
0
        public override void Enter(State prevState, EventArgs args)
        {
            var velocity = Unit.Owner.Velocity;

            velocity.x          = -Random.Range(Unit.Config.MinSpeed, Unit.Config.MaxSpeed);
            Unit.Owner.Velocity = velocity;
        }
Esempio n. 2
0
        public override void Enter(State prevState, EventArgs args = null)
        {
            var velocity = Unit.Owner.Velocity;

            velocity.x          = Config.Speed;
            Unit.Owner.Velocity = velocity;
        }
Esempio n. 3
0
        public override void Enter(State prevState, EventArgs args)
        {
            Unit.Owner.Velocity = Vector2.zero;

            PlayDeathEffect(() =>
            {
                Owner.SwitchState(PlayerStateType.Idle);
            });
        }
Esempio n. 4
0
        public override void Enter(State prevState, EventArgs args)
        {
            var mainMenu = _uiManager.Open <MainMenuController>();

            mainMenu.SetCallback(() =>
            {
                mainMenu.Close();
                Owner.SwitchState(GameStatesManager.GameState);
            });
        }
Esempio n. 5
0
        public override void Enter(State prevState, EventArgs args)
        {
            if (Unit.Owner.IsGrounded)
            {
                Unit.Owner.Velocity = new Vector2(Unit.Owner.Velocity.x, Config.JumpHeight);

                Unit.Animator.SetTrigger("IsJump");
            }

            Owner.PopState();
        }
Esempio n. 6
0
        public override void Enter(State prevState, EventArgs args = null)
        {
            var bullet = _factory.Create <BulletController>(Config.WeaponId, _visualRoot.Root);

            if (bullet != null)
            {
                bullet.StartMove();
                bullet.transform.position = Unit.transform.position;
            }

            Owner.PopState();
        }
Esempio n. 7
0
        private void UnitCollision(IUnit unit)
        {
            var enemyModel = unit.GetModel <Assets.Scripts.Game.Units.Enemy.EnemyModel>();

            if (enemyModel != null)
            {
                var data = new EventArgs();
                data.SetValue("Damage", enemyModel.Damage);

                StateMachine.HandleEvent(PlayerEventType.Damage, data);

                Damage?.Invoke(enemyModel.Damage);
            }
        }
Esempio n. 8
0
        public override void Enter(State prevState, EventArgs args)
        {
            if (args != null)
            {
                float damage = args.GetValue <float>("Damage");

                Unit.Model.Health -= damage;
                if (Unit.Model.Health <= 0)
                {
                    Owner.SwitchState(PlayerStateType.Death);
                    return;
                }
            }

            Owner.PopState();
        }
        private void UnitCollision(IUnit unit)
        {
            var bullet = unit.GetModel <BulletModel>();

            if (bullet != null)
            {
                var data = new EventArgs();
                data.SetValue("Damage", bullet.Damage);

                StateMachine.HandleEvent(EnemyEventType.Damage, data);
            }
            else
            {
                var player = unit.GetModel <PlayerModel>();
                if (player != null)
                {
                    StateMachine.SwitchState(EnemyStateType.Death);
                }
            }
        }
Esempio n. 10
0
 public override void Enter(State prevState, EventArgs args)
 {
 }
Esempio n. 11
0
 public override void Enter(State prevState, EventArgs args = null)
 {
     Unit.Animator.SetBool("IsMove", true);
 }
Esempio n. 12
0
 public override void Enter(State prevState, EventArgs args)
 {
     _prefabsFactory.Load();
 }