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; }
public override void Enter(State prevState, EventArgs args = null) { var velocity = Unit.Owner.Velocity; velocity.x = Config.Speed; Unit.Owner.Velocity = velocity; }
public override void Enter(State prevState, EventArgs args) { Unit.Owner.Velocity = Vector2.zero; PlayDeathEffect(() => { Owner.SwitchState(PlayerStateType.Idle); }); }
public override void Enter(State prevState, EventArgs args) { var mainMenu = _uiManager.Open <MainMenuController>(); mainMenu.SetCallback(() => { mainMenu.Close(); Owner.SwitchState(GameStatesManager.GameState); }); }
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(); }
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(); }
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); } }
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); } } }
public override void Enter(State prevState, EventArgs args) { }
public override void Enter(State prevState, EventArgs args = null) { Unit.Animator.SetBool("IsMove", true); }
public override void Enter(State prevState, EventArgs args) { _prefabsFactory.Load(); }