示例#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;
        }
示例#2
0
        public override void Enter(State prevState, EventArgs args = null)
        {
            var velocity = Unit.Owner.Velocity;

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

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

            mainMenu.SetCallback(() =>
            {
                mainMenu.Close();
                Owner.SwitchState(GameStatesManager.GameState);
            });
        }
示例#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();
        }
示例#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();
        }
示例#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);
            }
        }
示例#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);
                }
            }
        }
示例#10
0
 public override void Enter(State prevState, EventArgs args)
 {
 }
示例#11
0
 public override void Enter(State prevState, EventArgs args = null)
 {
     Unit.Animator.SetBool("IsMove", true);
 }
示例#12
0
 public override void Enter(State prevState, EventArgs args)
 {
     _prefabsFactory.Load();
 }