public override void OnExit() { //继承于AttackAction,所以不调用base //base.OnExit(); //Debug.LogWarning("AttackingMoveAction OnExit"); CurrentActor.StopPlaySkillEventAnimation(); }
public override void OnExit() { base.OnExit(); CurrentActor.EnableCollider(true); CurrentActor.Props.SetProperty_Int32(ENProperty.islive, 1); CurrentActor.SetCurHP(CurrentActor.MaxHP); }
public ActorAction AddAction(ActorAction.ENType newType) { if (!IsDisable(newType)) { bool isValidateActionState = false; for (int index = m_actionList.Count - 1; index >= 0; --index) { ActorAction item = m_actionList[index]; if (!item.IsEnable) { continue; } if (ActorAction.ENRelation.enReplace == CheckRelation(newType, item.GetActionType())) { m_actionList.RemoveAt(index); isValidateActionState = true; item.OnInterupt(); RemoveDisableCount(item.GetActionType()); item.IsEnable = false; ReleaseObj(item); } } ActorAction obj = CreateObj(newType); obj.CurrentActor = CurrentActor; if (null != CurrentActor.mActorBlendAnim) { CurrentActor.mActorBlendAnim.CurActionType = newType; } ActioningObjArray[(int)newType] = obj; m_actionList.Add(obj); AddDisableCount(obj.GetActionType()); if (isValidateActionState) { for (int i = 0; i < ActioningArray.Length; i++) { ActioningArray[i] = 0; ActioningObjArray[i] = null; } for (int i = 0; i < m_actionList.Count; i++) { ActorAction ac = m_actionList[i]; ActioningObjArray[(int)ac.GetActionType()] = ac; ActioningArray[(int)ac.GetActionType()]++; } } return(obj); } else { string currentActions = CurrentActor.GetType() + ":" + newType.ToString() + " Current Actions:"; foreach (ActorAction action in m_actionList) { currentActions += action.GetActionType().ToString() + ", "; } //Debug.LogWarning("Add action failed:" + newType.ToString()+" actor type:"+CurrentActor.Type.ToString()); return(null); } }
private void StartAnimation() { _isButtonPressed = true; _endEarlyButtonPressed = false; // CurrentActor.overheadHud.ShowInputIndicator(false); CurrentActor.PlayAbilityAnimation(); }
void OnBecameInvisible() { //角色模型会被复用,挂载此脚本的有可能不是npc if (CurrentActor != null) { CurrentActor.OnBecameInvisible(); //ActorManager.Singleton.ReleaseActor(CurrentActor.ID); } }
public override bool OnUpdate() { if (!CurrentActor.MainRigidBody.isKinematic) { CurrentActor.MainRigidBody.velocity = Vector3.zero; } //PlayAnimation时会更改MainPos的位置为RealPos,所以,要一直设置MainPos的位置,不让其改变(因为RealPos有可能不对) CurrentActor.UnhideMe(m_stayPos); return(Time.time - AnimStartTime > AnimLength); }
public override void OnExit() { CurrentActor.MainAnim.cullingType = AnimationCullingType.BasedOnRenderers; if (CurrentActor.CenterCollider != null) { CurrentActor.CenterCollider.gameObject.layer = LayerMask.NameToLayer("Actor"); } //将位移动画的位移回馈到角色,并且播放下一个动画,下一个动画不能Fade [8/11/2015 tgame] CurrentActor.ApplyAnimationOffset(); }
public override void OnEnter() { SyncPositionIfNeed(); RefreshActionRef(); //继承于AttackAction,所以不调用base //base.OnEnter(); m_skillResultIDIndex = 0; CurrentActor.StopPlaySkillEventAnimation(); CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)Actor.ENSkillStepType.enConduct, AnimName, Actor.ENAnimType.enPlay); }
void PlaySkillEventAnimation() { AttackStepInfo info = GetAttackStepInfo(); if (info == null || info.m_skillType == m_currentType) { return; } m_currentType = info.m_skillType; StopPlaySkillEventAnimation(); if (info.m_skillType == Actor.ENSkillStepType.enSlash) {//冲锋有动作融合 //计算冲刺的权重 if (m_skillInfo.SlashMotionDistance > 0 && m_skillTarget != null) { Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos; direction.y = 0f; float targetWeight = (direction.magnitude + m_skillInfo.SlashTargetPosOffset) / m_skillInfo.SlashMotionDistance; string blendAnimName = m_skillInfo.SlashBlendMotionName; if (targetWeight < 0) { targetWeight = 0; } CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType, info.m_animName, Actor.ENAnimType.enBlend, new float[] { (int)AnimationBlendMode.Blend, targetWeight, 0 }); CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType + 1, blendAnimName, Actor.ENAnimType.enBlend, new float[] { (int)AnimationBlendMode.Blend, 1 - targetWeight, 0 }); return; } } else if (info.m_skillType == Actor.ENSkillStepType.enRelease) {//释放有动作融合 if (m_skillInfo.ReleaseMotionDistance > 0 && m_skillTarget != null) { Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos; direction.y = 0f; float targetWeight = (direction.magnitude + m_skillInfo.ReleaseTargetPosOffset) / m_skillInfo.ReleaseMotionDistance; string blendAnimName = m_skillInfo.ReleaseBlendMotionName; if (!string.IsNullOrEmpty(blendAnimName)) { if (targetWeight < 0) { targetWeight = 0; } CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType, info.m_animName, Actor.ENAnimType.enBlend, new float[] { (int)AnimationBlendMode.Blend, targetWeight, 0 }); CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType + 1, blendAnimName, Actor.ENAnimType.enBlend, new float[] { (int)AnimationBlendMode.Blend, 1 - targetWeight, 0 }); return; } } } CurrentActor.PlaySkillEventAnimation(m_skillInfo.ID, (int)info.m_skillType, info.m_animName, Actor.ENAnimType.enPlay); }
public override bool OnUpdate() { if (ActorType.enNPC == CurrentActor.Type) { NPC npc = CurrentActor as NPC; float fDuration = 3.0f; if (npc.GetNpcType() == ENNpcType.enBoxNPC) {//宝箱永远不消失 fDuration = float.MaxValue; } else { if (npc.NpcBehaviour) { fDuration = npc.NpcBehaviour.DeadDuration; } fDuration += AnimLength; } if (Time.time - AnimStartTime > fDuration) { CurrentActor.MainRigidBody.isKinematic = m_isKinematic; ActorManager.Singleton.ReleaseActor(CurrentActor.ID); } if (!IsPlayOver && Time.time - AnimStartTime > AnimLength) { IsPlayOver = true; if (npc.GetNpcType() != ENNpcType.enBOSSNPC) { m_isKinematic = CurrentActor.MainRigidBody.isKinematic; CurrentActor.MainRigidBody.isKinematic = true; } CurrentActor.EnableCollider(false); } } else { float fDuration = AnimLength + 0.3f; if (Time.time - AnimStartTime > fDuration) { CurrentActor.MainRigidBody.isKinematic = m_isKinematic; } if (!IsPlayOver && Time.time - AnimStartTime > AnimLength) { IsPlayOver = true; m_isKinematic = CurrentActor.MainRigidBody.isKinematic; CurrentActor.MainRigidBody.isKinematic = true; CurrentActor.EnableCollider(false); } } return(false); }
public void SyncPositionIfNeed() { if (IsSyncPosition) { IsSyncPosition = false; Vector3 v = CurrentActor.MainPos - SyncPosition; if (v.sqrMagnitude > 2.5f) { CurrentActor.MoveTo(SyncPosition); } } }
/// <summary> /// Draws all of the space's sprites, then if it's occupied, its occupant's sprites. /// </summary> /// <param name="batch">Main game spritebatch.</param> /// <param name="drawPos">Top left corner from which to draw</param> public void draw(SpriteBatch batch, Vector2 drawPos) { spaceSprite.Draw(batch, new Rectangle((int)drawPos.X, (int)drawPos.Y, (int)ConstantHolder.HexagonGrid_HexSizeX, spaceSprite.SpriteSizeY), Color.White); for (int i = 0; i < 3; ++i) { walls[i].Draw(batch, drawPos); } if (isOccupied) { CurrentActor.Draw(batch, drawPos + new Vector2(ConstantHolder.HexagonGrid_HexSizeX / 2, ConstantHolder.HexagonGrid_HexSizeY)); } }
public void teleport(int index) { location = blockList[index].standPoint(); enterDirection = Direction.unKnow; //for(int i = 0 ; i < blockList.Length ; i++ ) //{ // if(block.Equals(blockList[i])) // { // currentBlockIndex = i; // } //} currentBlockIndex = index; CurrentActor.teleport(location); }
public override void OnEnter() { SyncPositionIfNeed(); RefreshActionRef(); CurrentActor.MainAnim.cullingType = AnimationCullingType.AlwaysAnimate; CurrentActor.StartCaution(); Vector3 direction = m_targetPos - m_curPos; direction.y = 0.0f; direction.Normalize(); CurrentActor.MoveRotation(Quaternion.LookRotation(direction.normalized) * Quaternion.LookRotation(Vector3.forward)); }
private List <GridObject> GetTargetsWithinRange(Tile originTile) { List <GridObject> result = new List <GridObject>(); foreach (GridObject gridObject in Gm.combatManager.gridObjects) { if (gridObject != CurrentActor && CurrentActor.HasAbilityThatCanReach(originTile.point, gridObject.point)) { result.Add(gridObject); } } return(result); }
protected override HashSet <GroupType> GetGroupTypes() { HashSet <GroupType> types = new HashSet <GroupType>() { GroupType.NO_GROUP }; if (CurrentActor != null) { types.UnionWith(CurrentActor.GetActorTags()); } return(types); }
private bool TryToAttackTarget(Combatant target) { if (!_hasAttacked && CurrentActor.HasAbilityThatCanReach(CurrentActor.point, target.point)) { _hasAttacked = true; Gm.combatManager.EnqueueCommand(new AbilityDetails(CurrentActor.GetCurrentlyPerformableAbilities()[0], CurrentActor, new List <GridObject> { target })); Gm.SwitchState(typeof(State_EnemyTurn_Performance), 0.5f); return(true); } return(false); }
private void MovePlayerUp() { if (CurrentActor.Tile.point.y == 0) { return; } Tile targetTile = Gm.tileManager.dungeonGen.grid[CurrentActor.Tile.point.x, CurrentActor.Tile.point.y + 1]; CurrentActor.LookAt(targetTile.point); if (PlayerCanMoveTo(targetTile)) { CurrentActor.MoveTo(targetTile); HighlightTargetsWithinRange(); } }
private void MovePlayerRight() { if (CurrentActor.Tile.point.x == Gm.tileManager.dungeonGen.grid.GetLength(0)) { return; } Tile targetTile = Gm.tileManager.dungeonGen.grid[CurrentActor.Tile.point.x + 1, CurrentActor.Tile.point.y]; CurrentActor.LookAt(targetTile.point); if (PlayerCanMoveTo(targetTile)) { CurrentActor.MoveTo(targetTile); HighlightTargetsWithinRange(); } }
/// <summary> /// Creates an enumerable collection of the entire series of GameResults for the game. /// </summary> private IEnumerable <GameResult> CreateProcessEnumerable() { while (true) { // Not using a foreach loop here so that we don't get a concurrent modification exception if an actor // is added or removed during the action. for (int actorIndex = 0; actorIndex < BattleMap.Actors.Count; actorIndex++) { CurrentActor = BattleMap.Actors[actorIndex]; CurrentActor.StartTurn(); //TODO: Add start of turn stuff. Perhaps make this a "foreach GameResult in" loop as well. This is used for any "start of turn" effects, like buffs running out, etc. while (CurrentActor.RemainingActions > 0) { // bail if we need to wait for the UI or AI to provide an action while (CurrentActor.NeedsInput) { Debug.Log("Waiting on user input."); yield return(new GameResult(false)); } // get the actor's action Action action = CurrentActor.TakeTurn(); { // process it and everything it leads to foreach (GameResult result in ProcessAction(action)) { yield return(result); } } } // actor.EndTurn(); - TODO: add end of turn stuff. Perhaps make this a "foreach GameResult in" loop as well. This is used for any "end of turn" effects, such as enemy debuffs running out, etc. // actor was killed, so remove from the collection and shift the next one up. if (!CurrentActor.IsAlive) { BattleMap.RemoveActor(CurrentActor); actorIndex--; } } // TODO: Process all of the items and other things that need to have something happen each turn // TODO: Turn/time increment (advance 1 turn/6 seconds, etc). } }
public override void OnEnter() { base.OnEnter(); Gm.inputController.BindActionToKey(Button.EndTurn, null, Gm.combatManager.EndTurn); if (CurrentActor.HasStatusEffect(typeof(Stun))) { Gm.combatManager.EndTurn(); return; } // DetermineAction(); _hasAttacked = false; MoveTowardsTarget(PickNewTarget()); Gm.delayBetweenNPCStateSwitches = 0.6f; }
/// <summary> /// Draws all of the space's sprites, then if it's occupied, its occupant's sprites. /// </summary> /// <param name="batch">Main game spritebatch.</param> /// <param name="drawPos">Top left corner from which to draw</param> public void draw(SpriteBatch batch, Vector2 drawPos) { spaceSprite.Draw(batch, new Rectangle((int)drawPos.X, (int)drawPos.Y, (int)ConstantHolder.HexagonGrid_HexSizeX, spaceSprite.SpriteSizeY), availableFlag ? Color.YellowGreen : Color.White); for (int i = 0; i < 3; ++i) { walls[i].Draw(batch, drawPos); } if (isOccupied) { CurrentActor.Draw(batch); } foreach (SpaceProjectile proj in projectilesInSpace) { proj.Draw(batch, drawPos); } }
public override void OnExit() { AnimationConfig animConfig = CurrentActor.MainAnim.GetComponent <AnimationConfig>(); if (null != animConfig && null != animConfig.Trail) { animConfig.Trail.ClearTrail(); } { AttackActionCallback callback = CurrentActor.GetBodyParentObject().GetComponent <AttackActionCallback>(); callback.enabled = false; } if (m_skillTarget != null && m_skillTarget != CurrentActor) {//面向目标 Vector3 direction = m_skillTarget.RealPos - CurrentActor.RealPos; direction.y = 0; // 由于这里修改旋转,会导致Actor的RealPos不正确,所以这里不能乱转 [8/19/2014 tgame] //CurrentActor.MoveRotation(Quaternion.LookRotation(direction.normalized) * Quaternion.LookRotation(Vector3.forward)); } m_effectObjList.Clear(); if (m_skillInfo.IsSlashExist) {//显示BoxCollider if (CurrentActor.CenterCollider != null) { CurrentActor.CenterCollider.gameObject.layer = LayerMask.NameToLayer("Actor"); } } if (null != CurrentActor.Combo) {//设置连接技的信息 CurrentActor.Combo.SetConnetionInfo(m_skillInfo.SkillConnectionType); } StopPlaySkillEventAnimation(); //隐藏body下的所有istrigger状态的collider CurrentActor.HideTriggerCollider(); //停止播放所有武器动作 CurrentActor.StopPlayWeaponsAnimation(); //隐藏武器 CurrentActor.ShowWeaponModelWithTable(false); //回馈位移动画 CurrentActor.ApplyAnimationOffset(); }
public override void OnEnter() { base.OnEnter(); _performanceHasEnded = false; _defPerformance = TimedActionController.Performance.Meh; EventManager <TimedActionController.Performance> .AddListener(EventType.OnDefencePerformanceMarked, MarkPerformance); EventManager <TimedActionController.Performance> .AddListener(EventType.OnEnemyAbilityEnd, FinishAction); Button[] inputButtons = Gm.inputController.AbilityInputButtons(); Button correctButton = inputButtons[Random.Range(0, inputButtons.Length)]; foreach (Button button in inputButtons) { Action downAction; if (button == correctButton) { downAction = CorrectButtonPressed; } else { downAction = WrongButtonPressed; } Gm.inputController.BindActionToKey(button, downAction, null); } Gm.combatManager.CurrentAbilityDetails.targets[0].overheadHud.inputIndicator.Show(true, Gm.inputController.GetKeyCode(correctButton)); Gm.hudManager.inputInfoInterface.ShowCommands(new Dictionary <string, string> { { Gm.inputController.GetKeyCode(correctButton).ToString(), "Block / Dodge" } }); // TODO: Below code causes an EventManager-related exception in the live build // if (Gm.combatManager.CurrentAbilityDetails.targets.Any(target => target is PCombatant)) // { // EventManager<AbilityDetails>.Invoke(EventType.OnEnemyAttackInitiated, Gm.combatManager.CurrentAbilityDetails); // } CurrentActor.PlayAbilityAnimation(); }
public override void OnEnter() { if (CurrentActor.m_isDeposited) {//托管中,发送beattack action的消息 Vector3 pos = CurrentActor.MainPos; IMiniServer.Singleton.SendAction_ActorExit_C2BS(CurrentActor.ID, pos); } RefreshActionRef(); //effect CurrentActor.PlayEffect("ef-e-switchout-E01", 0, "", false, Vector3.zero); if (!CurrentActor.MainRigidBody.isKinematic) { CurrentActor.MainRigidBody.velocity = Vector3.zero; } if (CurrentActor.IsDead) {//角色死亡 CurrentActor.HideMe(); } //MainGame.FaceToCameraWithoutY(CurrentActor.MainObj); }
private void RemoveEffect(List <string> effectNameList) { for (int i = 0; i < effectNameList.Count; ++i) { GameObject obj = null; if (m_effectList.TryGetValue(effectNameList[i], out obj)) { obj.SetActive(false); //PoolManager.Singleton.ReleaseObj(obj); } else { Transform boneT = CurrentActor.LookupBone(CurrentActor.MainObj.transform, effectNameList[i]); if (boneT) { boneT.gameObject.SetActive(false); //PoolManager.Singleton.ReleaseObj(boneT.gameObject); } } } }
IEnumerator Coroutine_Load(string effectName, float effectTime, string posByBone, bool isAdhered, Vector3 offset) { GameResPackage.AsyncLoadObjectData data = new GameResPackage.AsyncLoadObjectData(); IEnumerator e = PoolManager.Singleton.Coroutine_Load(GameData.GetEffectPath(effectName), data); while (true) { e.MoveNext(); if (data.m_isFinish) { break; } yield return(e.Current); } if (data.m_obj != null) { CurrentActor.PlayEffect(data.m_obj as GameObject, effectTime, posByBone, isAdhered, offset); if (!m_effectList.ContainsKey(effectName)) { m_effectList.Add(effectName, data.m_obj as GameObject); } } }
public HashSet <GroupType> GetGroupTypes(bool includeWeapons) { HashSet <GroupType> types = new HashSet <GroupType>() { GroupType.NO_GROUP }; foreach (HeroEquipData equipment in equipList) { if (equipment.equip == null) { continue; } if (equipment.equip is Weapon && !includeWeapons) { continue; } types.UnionWith(GetEquipmentGroupTypes(equipment.equip)); } if (GetEquipmentInSlot(EquipSlotType.WEAPON) is Weapon && !equipList[(int)EquipSlotType.WEAPON].isDisabled && GetEquipmentInSlot(EquipSlotType.OFF_HAND) is Weapon && !equipList[(int)EquipSlotType.OFF_HAND].isDisabled) { types.Add(GroupType.DUAL_WIELD); } if (CurrentActor != null) { types.UnionWith(CurrentActor.GetActorTags()); } return(types); }
public override void OnEnter() { if (CurrentActor.m_isDeposited) {//托管中,发送beattack action的消息 //Vector3 pos = CurrentActor.MainPos; IMiniServer.Singleton.SendAction_JumpIn_C2BS(CurrentActor.ID, CurrentActor.TargetManager.CurrentTarget.ID); } if (CurrentActor.TargetManager.CurrentTarget != null && !CurrentActor.TargetManager.CurrentTarget.IsDead) { Vector3 forward = CurrentActor.TargetManager.CurrentTarget.MainObj.transform.forward; m_stayPos = CurrentActor.TargetManager.CurrentTarget.RealPos + forward.normalized; CurrentActor.UnhideMe(m_stayPos); } else { IsEnable = true; return; } MainGame.FaceToCameraWithoutY(CurrentActor.MainObj); CurrentActor.MainAnim.cullingType = AnimationCullingType.AlwaysAnimate; RefreshActionRef(); }
public override void OnExit() { CurrentActor.GetBodyObject().transform.localPosition = Vector3.zero; CurrentActor.MainAnim.cullingType = AnimationCullingType.BasedOnRenderers; CurrentActor.HideMe(); }