/* 새로운 LandState로 업데이트 합니다. */ private void UpdateLandState(LandState newLandState) { switch (newLandState) { case LandState.LandState_None: case LandState.LandState_All: ActivateGravity(true); break; case LandState.LandState_Left: SetPositionOnlyParent(leftTrigger.transform.position); ActivateGravity(false); break; case LandState.LandState_Right: SetPositionOnlyParent(rightTrigger.transform.position); ActivateGravity(false); break; default: break; } landState = newLandState; }
public void ChangeLandAnimation(LandState state) { if (prevState == state) { return; } MonsterAni.SetInteger("MonsterState", (int)state); prevState = state; }
public override void Blocked_Bottom(GameInput input) { base.Blocked_Top(input); if (input.Left == input.Right) { animation = 0; } landState = LandState.OnGround; if (arm == ArmDirection.Lower) { arm = ArmDirection.Forward; } }
void Update() { LandState newLandState = TriggerCheck(); if (newLandState != landState) { UpdateLandState(newLandState); } UpdateLegRotation(); FaceRotateLock(); LegRoateLock(); }
void AddAnimalYardModel(HomePosInfo plant, LandState st) { IEntity en = HomeScene.Instance.AddEntity(plant.index.ToString(), EntityType.EntityType_Soil, animalID, (int)st); if (en != null) { en.SendMessage(EntityMessage.EntityCommand_SetPos, new Vector3(plant.posX, 2.966f, -plant.posZ)); HomeEntityInfo info = new HomeEntityInfo(); info.index = animalYardID; // plant.index; info.state = (int)st; info.type = EntityType.EntityType_Soil; info.entityID = en.GetUID(); AddHomeEntity(en.GetUID(), info); } }
private void OnDisable() { IdleState.Dispose(); MoveState.Dispose(); JumpState.Dispose(); InAirState.Dispose(); LandState.Dispose(); WallSlideState.Dispose(); LedgeClimbState.Dispose(); CrouchIdleState.Dispose(); CrouchMoveState.Dispose(); SwordAttackState.Dispose(); HandAttackState.Dispose(); AirAttackState.Dispose(); SlideState.Dispose(); }
public Player(GameScene game, int row, int col, Direction direction) : base(game, RECTANGLE, new Vector(col * Settings.BLOCK_WDITH, row * Settings.BLOCK_WDITH), Vector.Zero, INIT_HEALTH) { this.direction = direction; arm = ArmDirection.Forward; landState = LandState.InAir; weapon = Weapon.Pistol; ammo = 0; jumpCount = -1; fireCount = -1; animation = 0; enemyDamageCount = 0; freeze = false; armAnimation = 0; visible = true; drawHealth = health; focus = Vector.Zero; ammoHudColorCount = 0; ammoNumColorCount = 0; }
void ShowSoilModel(HomePosInfo plant, LandData ld) { LandState st = LandState.LockCanBuy; if (ld != null) { if (ld.farm_id == plant.index) { st = LandState.Idle; if (ld.land_state == 0 && ld.plant_begin != 0) { if (ld.remain_time == 0) { st = LandState.CanGain; } if (ld.remain_time != 0) { st = LandState.Growing; } } } } AddSoilModel(plant, st); }
partial void OnHanderStateChanging(LandState value);
/// <summary> /// 创建新的 Land_manager 对象。 /// </summary> /// <param name="id">ID 属性的初始值。</param> /// <param name="geo_GraphID">Geo_GraphID 属性的初始值。</param> /// <param name="land_TypeID">Land_TypeID 属性的初始值。</param> /// <param name="handerState">HanderState 属性的初始值。</param> /// <param name="standardadministrativecodeSacID">StandardadministrativecodeSacID 属性的初始值。</param> /// <param name="bussnessVerID">BussnessVerID 属性的初始值。</param> public static Land_manager CreateLand_manager(global::System.Int32 id, global::System.Int32 geo_GraphID, global::System.Int32 land_TypeID, LandState handerState, global::System.Int32 standardadministrativecodeSacID, global::System.Int32 bussnessVerID) { Land_manager land_manager = new Land_manager(); land_manager.ID = id; land_manager.Geo_GraphID = geo_GraphID; land_manager.Land_TypeID = land_TypeID; land_manager.HanderState = handerState; land_manager.StandardadministrativecodeSacID = standardadministrativecodeSacID; land_manager.BussnessVerID = bussnessVerID; return land_manager; }
partial void OnCurrentStateChanging(LandState value);
/// <summary> /// 创建新的 Land_Graph_Handle 对象。 /// </summary> /// <param name="id">ID 属性的初始值。</param> /// <param name="title">Title 属性的初始值。</param> /// <param name="taskContent">TaskContent 属性的初始值。</param> /// <param name="changeDate">ChangeDate 属性的初始值。</param> /// <param name="currentState">CurrentState 属性的初始值。</param> /// <param name="notes">Notes 属性的初始值。</param> /// <param name="land_TaskTypeID">Land_TaskTypeID 属性的初始值。</param> /// <param name="implementer">Implementer 属性的初始值。</param> /// <param name="land_managerID">Land_managerID 属性的初始值。</param> public static Land_Graph_Handle CreateLand_Graph_Handle(global::System.Int32 id, global::System.String title, global::System.String taskContent, global::System.String changeDate, LandState currentState, global::System.String notes, global::System.Int32 land_TaskTypeID, global::System.String implementer, global::System.Int32 land_managerID) { Land_Graph_Handle land_Graph_Handle = new Land_Graph_Handle(); land_Graph_Handle.ID = id; land_Graph_Handle.Title = title; land_Graph_Handle.TaskContent = taskContent; land_Graph_Handle.ChangeDate = changeDate; land_Graph_Handle.CurrentState = currentState; land_Graph_Handle.Notes = notes; land_Graph_Handle.Land_TaskTypeID = land_TaskTypeID; land_Graph_Handle.Implementer = implementer; land_Graph_Handle.Land_managerID = land_managerID; return land_Graph_Handle; }
public override void UpdateState(Character c, UserInput input, RaycastHit2D[] info) { this.info = info; //Debug.Log("Falling state updating"); //base.UpdateState(c, input); fallTimer += GameManager.Instance.DeltaTime; if (jumpDamper < 1) { jumpDamper += c.jumpMultiplier * 5 * GameManager.Instance.DeltaTime; } else { jumpDamper = 1; } c.currentJumpSpeed += c.gravity * 11.5f * jumpDamper * GameManager.Instance.DeltaTime * GameManager.Instance.DeltaTime; if (Mathf.Sign(c.currentJumpSpeed) < 0 && Mathf.Abs(c.currentJumpSpeed) > 0.65f) { c.currentJumpSpeed = -0.65f; } //c.currentLinearSpeed = input.xInput * c.maxSpeed * GameManager.Instance.DeltaTime * GameManager.Instance.DeltaTime; //Debug.Log("Fall timer: " + fallTimer); //float angle = 0; //float yCorr = 0; //CharacterUtility.CastRayAndOrientPlayer(c, out angle, out yCorr); //Debug.Log("Angle: " + angle); if (c.StateList.Count == index) { //animation AnimateState(c); //Music c.SetSoundEffect(c.playerAudio.fall, true, false, 1.5f); } if (info.Length > 0) { int count = 0; for (int i = 0; i < info.Length; i++) { if (info[i].collider.gameObject.layer != LayerMask.NameToLayer("Platform")) { count++; } else if (info[i].collider.tag == "tag_ladder") { count++; } } if (count == info.Length) { return; } if (angle < 65) { //Pause player movement for a while if (fallTimer > 0.08f) { c.BlockInputs(); //Debug.Log("blocking inputs"); } //c.State = null; //c.State = new LandState(); if (c.StateList.Count == index) { c.currentJumpSpeed = yCorr; c.StateList.RemoveAt(c.StateList.Count - 1); States nextState = new LandState(); nextState.index = c.StateList.Count + 1; c.StateList.Add(nextState); } if (Mathf.Abs(c.currentJumpSpeed) > 0) { c.currentJumpSpeed = 0; } } } //If the angle with the collider is greater than 65, then set the state as falling cuz player wont be able to walk on it }
public ControlSpMovement(ref IMovementAndMeleeCombatLogic input, ref IMove characterController , ref Animator animator, ref IRangedCombatLogic rangedLogic, ref IInvertoryLogic invertoryLogic, ref ISpCameraFollow camera) { this.rangedInput = rangedLogic; this.rangedInput.InputChanged += RangedInput_InputChanged; this.invertoryInput = invertoryLogic; this.spCamera = camera; // Movement FSM setup this.movementAndMeleeControl = input; this.fSMSpMovement = new FSMachineSpacemarineMove(EMovementID.Walking, ref this.movementAndMeleeControl, true); WalkState walkState = new WalkState(true, 2.0f, ref characterController, ref this.movementAndMeleeControl, EMovementID.Walking, ref animator); RunState runState = new RunState(false, 5.0f, ref characterController, ref this.movementAndMeleeControl, EMovementID.Running, ref animator); SmashState smashState = new SmashState(false, 6.0f, 1.25f, ref characterController, ref this.movementAndMeleeControl, EMovementID.Smashing, ref animator); FallState fallState = new FallState(2.0f, -Physics.gravity.y * Vector3.down, true, ref characterController, ref this.movementAndMeleeControl, EMovementID.Falling, ref animator); LandState landState = new LandState(0.75f, false, ref input, ref characterController, EMovementID.Landing); this.fSMSpMovement.AddState(walkState); this.fSMSpMovement.AddState(runState); this.fSMSpMovement.AddState(smashState); this.fSMSpMovement.AddState(fallState); this.fSMSpMovement.AddState(landState); this.fSMSpMovement.SetDefaultState(walkState); this.fSMSpMovement.StateChanged += FSMSpMovement_StateChanged; // Melee FSM machine setup AttackState attackState = new AttackState(false, EMeleeAttackID.Attacking, ref this.movementAndMeleeControl, ref invertoryLogic, ref animator); MeleeIdle meleeIdle = new MeleeIdle(true, EMeleeAttackID.Idle, ref this.movementAndMeleeControl); this.fSMSpCombat = new FSMCombatSpacemarine(true, EMeleeAttackID.Idle, ref this.movementAndMeleeControl, ref invertoryLogic); this.fSMSpCombat.AddState(attackState); this.fSMSpCombat.AddState(meleeIdle); this.fSMSpCombat.SetDefaultState(meleeIdle); //Ranged FSM setup IHoldWeapon holdWeaponInfo = new HoldPistol(5.0f); IRangedState holdState = new HoldState(true, ref rangedLogic, ERangedAttackID.Hold, ref holdWeaponInfo, ref animator, ref invertoryInput); IRangedShootState shootState = new ShootState(true, ERangedAttackID.Shoot, ref rangedLogic, ref animator, ref invertoryLogic); IRangedState reloadState = new ReloadState(true, ref rangedLogic, ERangedAttackID.Reload, ref invertoryLogic, ref animator); IRangedState laydownState = new LaydownState(true, ref rangedLogic, ERangedAttackID.LayDown, ref invertoryLogic); this.fSMSpRangedCombat = new FSMRangedSpacemarine(true, ERangedAttackID.LayDown, ref rangedLogic, ref invertoryLogic); this.fSMSpRangedCombat.AddState(holdState); this.fSMSpRangedCombat.AddState(reloadState); this.fSMSpRangedCombat.AddState(shootState); this.fSMSpRangedCombat.AddState(laydownState); this.fSMSpRangedCombat.SetDefaultState(laydownState); this.fSMSpRangedCombat.StateChanged += FSMSpRangedCombat_StateChanged; // Invertory Setup InvertoryIdle invertoryIdleState = new InvertoryIdle(true, ref invertoryLogic); InvertorySwitch invertorySwitchState = new InvertorySwitch(true, ref invertoryLogic, ref animator); this.fSMInvertory = new FSMInvertory(EInvertoryStateID.None, ref invertoryLogic); this.fSMInvertory.AddState(invertoryIdleState); this.fSMInvertory.AddState(invertorySwitchState); this.fSMInvertory.SetDefaultState(invertoryIdleState); this.fSMInvertory.StateChanged += FSMInvertory_StateChanged; if (invertoryLogic.HasInputModel) { this.spCamera.ObjectRotator.CanRotate = !invertoryLogic.InputInfo.CurrentWeapons.IsMeleeEquipment; this.spCamera.IsMeleeViewEnabled = !invertoryLogic.InputInfo.CurrentWeapons.IsMeleeEquipment; } else { this.spCamera.IsMeleeViewEnabled = false; } }
public override void Tick(GameInput input) { if (ammoHudColorCount > 0) { ammoHudColorCount--; } if (ammoNumColorCount > 0) { ammoNumColorCount--; } if (!freeze && visible) { #region ���E�̓��� if (input.Left == input.Right) { if (landState == LandState.InAir) { if (Math.Abs(velocity.X) > ACCELERATION_IN_AIR / 8) { velocity.X -= Math.Sign(velocity.X) * ACCELERATION_IN_AIR / 8; } else { velocity.X = 0; } } else if (landState == LandState.OnGround) { if (Math.Abs(velocity.X) > ACCELERATION_ON_GROUND) { velocity.X -= Math.Sign(velocity.X) * ACCELERATION_ON_GROUND; } else { velocity.X = 0; } } } else if (input.Left && !input.Right) { direction = Direction.Left; if (landState == LandState.InAir) { if (velocity.X > -MAX_MOVING_SPEED) { velocity.X -= ACCELERATION_IN_AIR; } } else if (landState == LandState.OnGround) { if (velocity.X > -MAX_MOVING_SPEED) { velocity.X -= ACCELERATION_ON_GROUND; } animation = (animation + 1) % NUM_ANIMATIONS; } } else if (input.Right && !input.Left) { direction = Direction.Right; if (landState == LandState.InAir) { if (velocity.X < MAX_MOVING_SPEED) { velocity.X += ACCELERATION_IN_AIR; } } else if (landState == LandState.OnGround) { if (velocity.X < MAX_MOVING_SPEED) { velocity.X += ACCELERATION_ON_GROUND; } animation = (animation + 1) % NUM_ANIMATIONS; } } if (Math.Abs(velocity.X) > MAX_MOVING_SPEED) { if (Math.Abs(velocity.X) - 1 < MAX_MOVING_SPEED) { velocity.X = Math.Sign(velocity.X) * MAX_MOVING_SPEED; } else { velocity.X -= Math.Sign(velocity.X); } } MoveBy_Horizontal(input, velocity.X); #endregion #region �㉺�̓��� velocity.Y += ACCELERATION_FALLING; if (velocity.Y > MAX_FALLING_SPEED) { velocity.Y = MAX_FALLING_SPEED; } if (landState == LandState.OnGround) { if (input.Jump) { if (jumpCount != -1) { landState = LandState.InAir; jumpCount = INIT_JUMP_COUNT; animation = (animation + (NUM_ANIMATIONS / 4)) % NUM_ANIMATIONS; } } else { jumpCount = 0; } } if (landState == LandState.InAir) { if (jumpCount > 0) { if (input.Jump) { velocity.Y = -JUMP_SPEED; jumpCount--; } else { jumpCount = -1; } } else { if (velocity.Y < 0) { jumpCount = -1; } else if (!input.Jump) { jumpCount = 0; } } } landState = LandState.InAir; MoveBy_Vertical(input, velocity.Y); #endregion #region �r if (input.Up == input.Down) { arm = ArmDirection.Forward; } else if (input.Up) { arm = ArmDirection.Upper; } else if (input.Down && landState == LandState.InAir) { arm = ArmDirection.Lower; } #endregion #region �e�۔��� if (input.Attack && fireCount <= 0) { if (weapon == Weapon.Pistol) { fireCount = INIT_FIRE_COUNT; } else if (weapon == Weapon.Machinegun) { fireCount = INIT_FIRE_COUNT / 2; } else if (weapon == Weapon.Rocket) { fireCount = INIT_FIRE_COUNT * 2; } else if (weapon == Weapon.Shotgun) { fireCount = INIT_FIRE_COUNT * 4; } else if (weapon == Weapon.Flamethrower) { if (fireCount == -1) { game.PlaySound(GameSound.Flame); } fireCount = 1; } armAnimation = 16; FireWeapon(weapon); /* if (direction == Direction.Left) { game.AddPlayerBullet(new PlayerBullet(game, position + new Vector(0, 32), 180)); // game.AddParticle(new PlayerBulletExplosion(game, position + new Vector(0, 32), velocity * 0.5)); } else { game.AddPlayerBullet(new PlayerBullet(game, position + new Vector(32, 32), 0)); // game.AddParticle(new PlayerBulletExplosion(game, position + new Vector(32, 32), velocity * 0.5)); } */ } if (fireCount > -1) { fireCount--; } if (armAnimation > 0) { armAnimation--; } #endregion #region �A�C�e���擾 foreach (Thing item in game.Items) { if (Overlappes(this, item)) { GetItem((Item)item); } } #endregion } #region �J�����ʒu�̕ if (direction == Direction.Left) { focus.X -= 2; } else { focus.X += 2; } if (Math.Abs(focus.X) > Settings.SCREEN_WIDTH / 8) focus.X = Math.Sign(focus.X) * Settings.SCREEN_WIDTH / 8; if (Center.X + focus.X < Settings.SCREEN_WIDTH / 2) { focus.X = Settings.SCREEN_WIDTH / 2 - Center.X; } else if (Center.X + focus.X > game.Map.Width - Settings.SCREEN_WIDTH / 2) { focus.X = game.Map.Width - Settings.SCREEN_WIDTH / 2 - Center.X; } #endregion if (enemyDamageCount > 0) { enemyDamageCount--; } /* if (drawHealth < health) { drawHealth++; } else if (drawHealth > health) { drawHealth--; } */ drawHealth = health + (drawHealth - health) * 3 / 4; if (game.DebugMode) { if (health < 100) { health++; } } base.Tick(input); }
public override void Tick(GameInput input) { if (ammoHudColorCount > 0) { ammoHudColorCount--; } if (ammoNumColorCount > 0) { ammoNumColorCount--; } if (!freeze && visible) { #region 左右の動き if (input.Left == input.Right) { if (landState == LandState.InAir) { if (Math.Abs(velocity.X) > ACCELERATION_IN_AIR / 8) { velocity.X -= Math.Sign(velocity.X) * ACCELERATION_IN_AIR / 8; } else { velocity.X = 0; } } else if (landState == LandState.OnGround) { if (Math.Abs(velocity.X) > ACCELERATION_ON_GROUND) { velocity.X -= Math.Sign(velocity.X) * ACCELERATION_ON_GROUND; } else { velocity.X = 0; } } } else if (input.Left && !input.Right) { direction = Direction.Left; if (landState == LandState.InAir) { if (velocity.X > -MAX_MOVING_SPEED) { velocity.X -= ACCELERATION_IN_AIR; } } else if (landState == LandState.OnGround) { if (velocity.X > -MAX_MOVING_SPEED) { velocity.X -= ACCELERATION_ON_GROUND; } animation = (animation + 1) % NUM_ANIMATIONS; } } else if (input.Right && !input.Left) { direction = Direction.Right; if (landState == LandState.InAir) { if (velocity.X < MAX_MOVING_SPEED) { velocity.X += ACCELERATION_IN_AIR; } } else if (landState == LandState.OnGround) { if (velocity.X < MAX_MOVING_SPEED) { velocity.X += ACCELERATION_ON_GROUND; } animation = (animation + 1) % NUM_ANIMATIONS; } } if (Math.Abs(velocity.X) > MAX_MOVING_SPEED) { if (Math.Abs(velocity.X) - 1 < MAX_MOVING_SPEED) { velocity.X = Math.Sign(velocity.X) * MAX_MOVING_SPEED; } else { velocity.X -= Math.Sign(velocity.X); } } MoveBy_Horizontal(input, velocity.X); #endregion #region の動き velocity.Y += ACCELERATION_FALLING; if (velocity.Y > MAX_FALLING_SPEED) { velocity.Y = MAX_FALLING_SPEED; } if (landState == LandState.OnGround) { if (input.Jump) { if (jumpCount != -1) { landState = LandState.InAir; jumpCount = INIT_JUMP_COUNT; animation = (animation + (NUM_ANIMATIONS / 4)) % NUM_ANIMATIONS; } } else { jumpCount = 0; } } if (landState == LandState.InAir) { if (jumpCount > 0) { if (input.Jump) { velocity.Y = -JUMP_SPEED; jumpCount--; } else { jumpCount = -1; } } else { if (velocity.Y < 0) { jumpCount = -1; } else if (!input.Jump) { jumpCount = 0; } } } landState = LandState.InAir; MoveBy_Vertical(input, velocity.Y); #endregion #region 腕 if (input.Up == input.Down) { arm = ArmDirection.Forward; } else if (input.Up) { arm = ArmDirection.Upper; } else if (input.Down && landState == LandState.InAir) { arm = ArmDirection.Lower; } #endregion #region 弾丸発射 if (input.Attack && fireCount <= 0) { if (weapon == Weapon.Pistol) { fireCount = INIT_FIRE_COUNT; } else if (weapon == Weapon.Machinegun) { fireCount = INIT_FIRE_COUNT / 2; } else if (weapon == Weapon.Rocket) { fireCount = INIT_FIRE_COUNT * 2; } else if (weapon == Weapon.Shotgun) { fireCount = INIT_FIRE_COUNT * 4; } else if (weapon == Weapon.Flamethrower) { if (fireCount == -1) { game.PlaySound(GameSound.Flame); } fireCount = 1; } armAnimation = 16; FireWeapon(weapon); /* * if (direction == Direction.Left) * { * game.AddPlayerBullet(new PlayerBullet(game, position + new Vector(0, 32), 180)); * // game.AddParticle(new PlayerBulletExplosion(game, position + new Vector(0, 32), velocity * 0.5)); * } * else * { * game.AddPlayerBullet(new PlayerBullet(game, position + new Vector(32, 32), 0)); * // game.AddParticle(new PlayerBulletExplosion(game, position + new Vector(32, 32), velocity * 0.5)); * } */ } if (fireCount > -1) { fireCount--; } if (armAnimation > 0) { armAnimation--; } #endregion #region アイテム取得 foreach (Thing item in game.Items) { if (Overlappes(this, item)) { GetItem((Item)item); } } #endregion } #region カメラ位置の補正 if (direction == Direction.Left) { focus.X -= 2; } else { focus.X += 2; } if (Math.Abs(focus.X) > Settings.SCREEN_WIDTH / 8) { focus.X = Math.Sign(focus.X) * Settings.SCREEN_WIDTH / 8; } if (Center.X + focus.X < Settings.SCREEN_WIDTH / 2) { focus.X = Settings.SCREEN_WIDTH / 2 - Center.X; } else if (Center.X + focus.X > game.Map.Width - Settings.SCREEN_WIDTH / 2) { focus.X = game.Map.Width - Settings.SCREEN_WIDTH / 2 - Center.X; } #endregion if (enemyDamageCount > 0) { enemyDamageCount--; } /* * if (drawHealth < health) * { * drawHealth++; * } * else if (drawHealth > health) * { * drawHealth--; * } */ drawHealth = health + (drawHealth - health) * 3 / 4; if (game.DebugMode) { if (health < 100) { health++; } } base.Tick(input); }