public Statistics() { Actions = new Action(); CharacterActions = new CharacterAction(); Kills = new Kill(); MapUnits = new MapUnit(); }
public void Dialog(GameObject targetObj) { targetLocation = targetObj.transform.position + 2*targetObj.transform.forward; targetLocation = new Vector3(targetLocation.x,0,targetLocation.z); targetObject = targetObj; _characterAction = CharacterAction.Dialog; }
//一番最初に1度だけ呼ばれる void Start() { if (Camera.main != null) { _mainCam = Camera.main.transform; } _characterAction = GetComponent<CharacterAction>(); }
public void TestNextActionFromPattern_Defend() { mockPattern.SetupGet(pattern => pattern[It.IsAny <int>()]) .Returns(new Mock <DefendTemplate>().Object); mockPattern.SetupGet(pattern => pattern.Length).Returns(1); enemy.SetActionPattern(mockPattern.Object); CharacterAction action = enemy.NextActionFromPattern(player); Assert.True(action is Defend); Assert.AreSame(player, action.Targets[0]); }
void GrabObject() { if (damObject != null && damObject.canBeGrabbed() && objectHolded == false) { moveSpeed /= speedMalus; damObject.GetComponent <Rigidbody2D>().velocity = Vector2.zero; damObject.transform.parent = this.gameObject.transform; action = CharacterAction.BringingObject; objectHolded = true; damObject.grabObject(transform, team, playerId); } }
private void SetSkillAllFrontline(CharacterAction skill) { foreach (var character in Frontline) { if (character.CurrentAction == CharacterAction.Reserve) { FrontlineTempCount += 1; } character.CurrentAction = skill; } }
// Update is called once per frame void Update() { if (!isLocalPlayer) { return; } CmdUpdateAction(playerController.getCurrentAction()); CmdUpdatePosition(playerController.getCurrentPosition()); characterAction = playerController.getCurrentAction(); characterPosition = playerController.getCurrentPosition(); print(playerController.getCurrentAction()); }
public bool ChangeMoveAction(CharacterAction action) { if (action != _currentAction) { _currentMoveAction = action; if (ChangeAction(_currentMoveAction)) { return(true); } } return(false); }
public static bool JudgingFirstSuccess(CharacterAction action, BasePerson person) { float successRate = 0; int index = 0; // TODO:因为要交毕设而先让其勉强能运行,之后还需要改 if (action.NeedProperty.Athletics != 0) { index++; successRate = successRate + (action.SuccessRate + ((person.propertyStruct.Athletics - action.NeedProperty.Athletics) / (person.propertyStruct.Athletics + action.NeedProperty.Athletics))); } if (action.NeedProperty.Creativity != 0) { index++; successRate += action.SuccessRate + ((person.propertyStruct.Creativity - action.NeedProperty.Creativity) / (person.propertyStruct.Creativity + action.NeedProperty.Creativity)); } if (action.NeedProperty.Logic != 0) { index++; successRate += action.SuccessRate + ((person.propertyStruct.Logic - action.NeedProperty.Logic) / (person.propertyStruct.Logic + action.NeedProperty.Logic)); } if (action.NeedProperty.Talk != 0) { index++; successRate += action.SuccessRate + ((person.propertyStruct.Talk - action.NeedProperty.Talk) / (person.propertyStruct.Talk + action.NeedProperty.Talk)); } if (index != 0) { successRate /= index; } else { successRate = 1; } if (successRate > 0) { // 成功 return(true); } else { // 失败 return(false); } }
private void Update() { // Update states based on animations. // (I'm hoping there is a better way to do this) // (It's mostly handled in the relevant functions now. Need to keep Idle at least) if (!anim.GetBool("Walking")) { if (anim.GetCurrentAnimatorStateInfo(0).IsName("Idle")) { action = CharacterAction.IDLE; } } if (anim.GetCurrentAnimatorStateInfo(0).IsName("Light Attack (Return)")) { action = CharacterAction.DELAY; } if (anim.GetCurrentAnimatorStateInfo(0).IsName("Heavy Attack (Windup)")) { action = CharacterAction.DELAY; } if (anim.GetCurrentAnimatorStateInfo(0).IsName("Heavy Attack (Swing)")) { action = CharacterAction.HEAVY_ATTACKING; } if (anim.GetCurrentAnimatorStateInfo(0).IsName("Heavy Attack (Return)")) { action = CharacterAction.DELAY; } if (anim.GetCurrentAnimatorStateInfo(0).IsName("Stun")) { action = CharacterAction.STUN; } if (anim.GetCurrentAnimatorStateInfo(0).IsName("Die")) { action = CharacterAction.DEAD; } if (anim.GetCurrentAnimatorStateInfo(0).IsName("Respawn")) { action = CharacterAction.RESPAWNING; } _setSwordState(); _setShieldState(); }
public void UseAction(int index) { index = index % (actions.Length); usedAction = actions[index]; usedAction.Performer = transform; usedAction.Target = target.transform; usedAction.ActivateAction(); string actionUpdate = usedAction.Performer.GetComponent <IDamageable>().GetName() + " used " + usedAction.ActionName + " on " + usedAction.Target.GetComponent <IDamageable>().GetName(); PlaningUI.ActionUsed(actionUpdate); }
/// <summary> /// Выполнение сводится к вызову раз в определенный интервал события, которое обрабатывается скриптами тайлов (урон), /// до тех пор, пока не вызовется событие окончания действия, которое обработается в OnTileWorkedOut /// </summary> public override IEnumerator Execute(CharacterAction actionData) { isDigging = true; this.actionData = actionData; while (isDigging) { yield return(new WaitForSeconds(digState.iterationsInterval)); digState.iterationEvent.Raise(actionData); actionData.LearnSkill(); } this.actionData = null; }
public void NotifyInitiativeSelectSkillOrStunt(CharacterAction action, Character initiative, Character passive) { if (!_isUsing) { return; } var message = new StorySceneCheckerNotifyInitiativeSelectSkillOrStuntMessage(); message.initiativeCharacterID = initiative.ID; message.passiveCharacterID = passive.ID; message.action = action; _connection.SendMessage(message); }
private void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.layer == 4) { state = CharacterState.Walking; } else if (collision.gameObject.layer == 8 && collision.GetComponent <Throwable>().throwing) { collision.GetComponent <BoxCollider2D>().enabled = true; damObject = null; action = CharacterAction.WaitingForAction; } }
public CallBack helpOtherReturn; //援护后的回调 public void dead() { if (getState() == enum_character_state.deading | getState() == enum_character_state.deaded) { return; } EffectManager.Instance.CreateEffect(hitPoint.transform, "Effect/Single/die_effect"); CharacterAction ac = new CharacterAction(enum_character_Action.Dead); setState(ac); }
public virtual CharacterAction GetNextAction() { cleanupQueue(); if (characterActionsByRound.Count == 0) { throw new NoCharacterActionExistsException("GetNextAction: no actions remaining in queue"); } CharacterAction nextAction = characterActionsByRound.First().Dequeue(); cleanupQueue(); onActionQueueUpdated(); return(nextAction); }
/// <summary> /// Adds the assets needed for each move /// </summary> /// <param name="playTime">The time it takes for the animation to run</param> /// <param name="imageSize">The size of each individual image</param> /// <param name="spriteSheet">The spritesheet to draw as the animation for this move</param> /// <param name="scale">The scale needed to fit the textures on the screen properly</param> /// <param name="hitboxes">The texture of the hitboxes for moves. Must be the same image size AND scale as /// spriteSheet</param> /// <param name="function">The function to run when this move is used</param> /// <param name="effect">Any effects to play when this move is used</param> public MoveAssets(float playTime, Point imageSize, Texture2D spriteSheet, int scale, Texture2D hitboxes, MoveFunction function, params SoundEffect[] effect) { HitboxTexture = hitboxes; Animation = new CharacterAction(playTime, imageSize, spriteSheet, scale); if (effect != null) { Sound = new AudioHandler(effect); } HitboxVertices = CreateVerticesFromTexture(hitboxes, scale, imageSize); Function = function; Started = DateTime.Now; }
void choosePlayerAction(CharacterAction action, CombatHandler handler) { switch (action) { case CharacterAction.Attack: handler.Attack(); break; case CharacterAction.Skill: handler.UseSkill(); break; } }
public void TestRequestNextAction() { Player mockPlayer = new Mock <Player>("name", 100, 1).Object; Enemy mockEnemy = new Mock <Enemy>("name", 100, 1).Object; CharacterAction mockCharacterAction = new Mock <CharacterAction>(mockEnemy, null, null).Object; mockEnemyActionManager.Setup(manager => manager.RequestNextAction(It.IsAny <Enemy>(), It.IsAny <Player>())).Returns(mockCharacterAction); characterManager.RegisterCharacter(mockPlayer); CharacterAction characterAction = characterManager.RequestNextAction(mockEnemy); Assert.AreSame(mockCharacterAction, characterAction); mockEnemyActionManager.Verify(manager => manager.RequestNextAction(mockEnemy, mockPlayer)); }
/// <summary> /// </summary> /// <param name="sender"> /// </param> /// <param name="message"> /// </param> public void Handle(object sender, Message message) { var client = (ZoneClient)sender; var characterActionMessage = (CharacterActionMessage)message.Body; CharacterAction.Read(characterActionMessage, client); if (client != null) { if (client.Character != null) { client.Character.SendChangedStats(); } } }
/// <summary> /// Выполнение сводится к вызову раз в определенный интервал события, которое обрабатывается скриптами тайлов (урон), /// до тех пор, пока не вызовется событие окончания действия, которое обработается в OnTileWorkedOut или пока не /// событие не вызовется определенное количество раз /// </summary> public override IEnumerator Execute(CharacterAction actionData) { isMining = true; this.actionData = actionData; while (isMining && iterationCount < mineState.maxIterations) { yield return(new WaitForSeconds(mineState.iterationsInterval)); mineState.iterationEvent.Raise(actionData); actionData.LearnSkill(); iterationCount++; } EndIterations(); }
public void NotifyPassiveSelectSkillOrStunt(CharacterAction action, SceneObject passive, SceneObject initiative, SkillType initiativeSkillType) { if (!_isUsing || !BattleSceneContainer.Instance.IsChecking) { return; } var message = new BattleSceneCheckerNotifyPassiveSelectSkillOrStuntMessage(); message.passiveObj = StreamableFactory.CreateBattleSceneObject(passive); message.initiativeObj = StreamableFactory.CreateBattleSceneObject(initiative); message.initiativeSkillType = StreamableFactory.CreateSkillTypeDescription(initiativeSkillType); message.action = action; _connection.SendMessage(message); }
public override void ReadFrom(IDataInputStream stream) { abilityTypeOrStuntID.ReadFrom(stream); isStunt = stream.ReadBoolean(); action = (CharacterAction)stream.ReadByte(); dstCenter.ReadFrom(stream); int length = stream.ReadInt32(); targetsID = new Identification[length]; for (int i = 0; i < length; ++i) { targetsID[i].ReadFrom(stream); } }
public void NotifyPassiveSelectSkillOrStunt(CharacterAction action, Character passive, Character initiative, SkillType initiativeSkillType) { if (!_isUsing) { return; } var message = new StorySceneCheckerNotifyPassiveSelectSkillOrStuntMessage(); message.passiveCharacterID = passive.ID; message.initiativeCharacterID = initiative.ID; message.initiativeSkillType = StreamableFactory.CreateSkillTypeDescription(initiativeSkillType); message.action = action; _connection.SendMessage(message); }
public override void ReadFrom(IDataInputStream stream) { skillTypeOrStuntID = stream.ReadString(); isStunt = stream.ReadBoolean(); action = (CharacterAction)stream.ReadByte(); dstCenter.ReadFrom(stream); int length = stream.ReadInt32(); targets = new string[length]; for (int i = 0; i < length; ++i) { targets[i] = stream.ReadString(); } }
public virtual void GameUpdate() { /// rigid body velocity character.velocity = InputManager.MainJoystickXY() * (float)characterData.CharacterVelocity(); direction = GetDirection(); // SET CHARACTER STATE TimeAtack = Mathf.Clamp(TimeAtack, 0, 0.3f); // if atack time has ended and player atack again if ((Input.GetKeyDown(KeyCode.Z) || InputManager.XButton(false)) && TimeAtack == 0 && !disableAtack) { TimeAtack = 0.5f; action = CharacterAction.Atacking; } // is in time atack if (TimeAtack > 0 && action == CharacterAction.Atacking && !disableAtack) { // character.velocity = Vector2.zero;//alternative character.velocity = character.velocity / 8; TimeAtack -= Time.deltaTime; action = CharacterAction.Atacking; } else { //IDLE if (character.velocity == Vector2.zero) { action = CharacterAction.Idle; } // WALK else if (character.velocity != Vector2.zero) { action = CharacterAction.Walking; if (character.velocity != Vector2.zero && (Input.GetKeyDown(KeyCode.LeftShift) || InputManager.RButton(true))) { action = CharacterAction.Running; character.velocity = character.velocity * (float)characterData.GamerVelocityMultplyer(); } } // RUN } // GUARD }
public static bool JudgingSecondSuccess(CharacterAction action, BasePerson person) { float successRate = 0; int index = 0; // TODO:因为要交光盘所以先临时让其可以运行,之后还需再改,改得通用一些 if (action.NeedProperty.Athletics != 0) { index++; successRate += person.propertyStruct.Athletics / (person.propertyStruct.Athletics + action.NeedProperty.Athletics); } if (action.NeedProperty.Creativity != 0) { index++; successRate += person.propertyStruct.Creativity / (person.propertyStruct.Creativity + action.NeedProperty.Creativity); } if (action.NeedProperty.Logic != 0) { index++; successRate += person.propertyStruct.Logic / (person.propertyStruct.Logic + action.NeedProperty.Logic); } if (action.NeedProperty.Talk != 0) { index++; successRate += person.propertyStruct.Talk / (person.propertyStruct.Talk + action.NeedProperty.Talk); } if (index != 0) { successRate /= index; } else { successRate = 1; } if (successRate > 0) { // 大成功 return(true); } else { // 成功 return(false); } }
// Use this for initialization void Start( ) { if (Camera.main == null) { Debug.LogError("Error: no main camera found"); } else { m_Cam = Camera.main.transform; } m_action = GetComponent<CharacterAction>(); m_agent = GetComponent<NavMeshAgent>(); m_animator = GetComponent<Animator>(); m_ctrled = GetComponent<Controlled>(); }
private void FixedUpdate() { foreach ((Actions actions, float[] parameters) in _currentFrameCharacterActions) { var newCharacterAction = new CharacterAction(actions, parameters, Time.time - timeWhenActStarted); PlayerActions.Add(newCharacterAction); if (logEveryAction) { Logging.Log(newCharacterAction, this); } } _currentFrameCharacterActions.Clear(); }
void letOpponentChooseMove() { CharacterAction decision = getCpuDecision(); switch (decision) { case CharacterAction.Attack: CpuParty.GetRotatedInCharacter().AttackTarget(PlayerParty.GetRotatedInCharacter()); break; case CharacterAction.Skill: CpuParty.GetRotatedInCharacter().TryUseSkill(PlayerParty.GetRotatedInCharacter()); break; } }
public void TestUse() { bool actionRun = false; Action testAction = () => { actionRun = true; }; Character mockActor = new Mock <Character>("name", 100, 1).Object; Character mockTarget = new Mock <Character>("name", 100, 1).Object; CharacterAction characterAction = new CharacterAction(mockActor, testAction, mockTarget); characterAction.Use(); Assert.True(actionRun); }
public void OnAbilityButtonPressed(string name) { if (allowedActions.ContainsKey(name)) { currentAction = allowedActions[name]; if (currentAction.GetType() == typeof(SpellAction)) { fallbackAction = (SpellAction)currentAction; } } else { currentAction = allowedActions["Move"]; } }
private void AddButton(CharacterAction action, Character cData) { GameObject go = Instantiate(Button_Template) as GameObject; go.SetActive(true); go.name = action.ID; ActionButton TB = go.GetComponent<ActionButton>(); TB.SetName(action.Name.ToUpper()); TB.SetID(action.ID); TB.SetCharacter(activeChar.ID); // attaches button to character //TB.SetPicture(cha.PictureID); go.transform.SetParent(Button_Template.transform.parent); go.transform.localScale = new Vector3(1, 1, 1); // to offset canvas scaling go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0); buttonList.Add(go); }
// Use this for initialization private void Start() { action = CharacterAction.IDLE; stock = GameController.stockMax; HP = GameController.hpMax; isInvulnerable = false; // Set all event times to a negative, so their relevant conditions don't trigger disarmed = false; shieldBroken = false; movementDisabled = false; rollDisabled = false; _sprites = GetComponentsInChildren <SpriteRenderer>(); }
public Role(int id) { Id = id; Level = 1; Exp = 0; SkillLevel = ""; DungeonLevel = 0; RoleAction = CharacterAction.None; SearchCD = 100f; DiggingCD = 100f; SkillCD = 100f; ForwardShake = 100f; AfterShake = 100f; }
void Start() { //Get reference to level info from the game manager levelInfo = GameManager.instance.levelInfo; characterAction = GetComponent<CharacterAction>(); characterAnimation = GetComponent<CharacterAnimation>(); //Get spawn node if player, enemies are set when spawned if(isPlayer) spawnNode = levelInfo.GetSpawnTile(TileNode.Type.PlayerSpawn); //Start character at spawn node transform.position = spawnNode.worldPosition; //Set array position to spawn node MoveToNode(spawnNode.gridPosition); //set target position to current newPos = transform.position; }
private Sprite GetActionSprite(CharacterAction Action) { string Path = string.Empty; switch (Action) { case CharacterAction.HUNGER_UP: { Path = "Images/CharacterActions/HungerUp"; break; } case CharacterAction.RELOAD: { Path = "Images/CharacterActions/HungerUp"; break; } case CharacterAction.SHOOT: { Path = "Images/CharacterActions/Shoot"; break; } case CharacterAction.THROW_GRENADE: { Path = "Images/CharacterActions/ThrowGrenade"; break; } default : { Path = "Images/CharacterActions/HungerUp"; break; } } Sprite ActionSprite = Resources.Load<Sprite> (Path); return ActionSprite; }
private void OnActionButtonClick(CharacterAction Action) { if (OnCharacterActionButtonClickEvent != null) { OnCharacterActionButtonClickEvent(Action); } }
private void OnActionButtonClick(CharacterAction Action) { switch (Action) { case CharacterAction.THROW_GRENADE : { SetState(new ThrowGrenadeState(this, FireTeamCharacters.GetSelectedSoldier().GetPosition())); break; } case CharacterAction.SHOOT : { SetState(new FireTeamTurnState(this)); break; } default : { Debug.LogWarning("Неизвестное действие : " + Action); break; } } }
public void OnStartTurn() { actionPoints = 3; currentAction = allowedActions["Move"]; fallbackAction = (SpellAction)allowedActions["basic"]; }
public CharacterItem(CharacterAction ItemAction, int ItemCount) { Action = ItemAction; Count = ItemCount; }
void SetAction(CharacterAction npcAction) { }
public static void ReadActionXMLFiles() { string path = Application.dataPath; GlobalGameData gameDataRef = GameObject.Find("GameManager").GetComponent<GlobalGameData>(); XmlDocument xmlDoc = new XmlDocument(); // creates the new document TextAsset actionData = null; actionData = Resources.Load("Action XML Data") as TextAsset; // load the XML file from the Resources folder xmlDoc.LoadXml(actionData.text); // and add it to the xmldoc object XmlNodeList actionList = xmlDoc.GetElementsByTagName("Row"); // separate elements by type (trait, in this case) foreach (XmlNode Action in actionList) { XmlNodeList actionContent = Action.ChildNodes; CharacterAction currentAction = new CharacterAction(); foreach (XmlNode action in actionContent) { if (action.Name == "ID") { currentAction.ID = action.InnerText; } if (action.Name == "NAME") { currentAction.Name = action.InnerText; } if (action.Name == "RANK") { currentAction.Category = (CharacterAction.eType)int.Parse(action.InnerText); } if (action.Name == "DESCRIPTION") { currentAction.Description = action.InnerText; } if (action.Name == "VIC_E") { currentAction.ViceroyValid = bool.Parse(action.InnerText); } if (action.Name == "SYSGOV_E") { currentAction.SysGovValid = bool.Parse(action.InnerText); } if (action.Name == "PROGOV_E") { currentAction.ProvGovValid = bool.Parse(action.InnerText); } if (action.Name == "PRIME_E") { currentAction.PrimeValid = bool.Parse(action.InnerText); } if (action.Name == "ALL_E") { currentAction.AllValid = bool.Parse(action.InnerText); } if (action.Name == "INQ_E") { currentAction.InquisitorValid = bool.Parse(action.InnerText); } if (action.Name == "EMP_NEAR") { currentAction.EmperorNearValid = bool.Parse(action.InnerText); } if (action.Name == "EMP_ACTION") { currentAction.EmperorAction = bool.Parse(action.InnerText); } } // add the trait once done characterActionList.Add(currentAction); } gameDataRef.CharacterActionList = characterActionList; }
private void ShowSingleActionIcon(CharacterAction Action) { GameObject ActionObject = new GameObject("ActionObject", typeof(RectTransform)); ActionObject.transform.SetParent(transform, false); ActionObject.transform.position = new Vector3 (350 + (60 * CharacterActionIcons.Count), 40, 0); ActionObject.AddComponent<CanvasRenderer>(); ActionObject.layer = 5; Image ActionButtonImage = ActionObject.AddComponent<Image>(); ActionButtonImage.overrideSprite = GetActionSprite(Action); ActionButtonImage.rectTransform.sizeDelta = new Vector2(50, 50); ActionButtonImage.transform.SetParent(GameObject.Find ("Canvas").transform, false); Button ActionButton = ActionObject.AddComponent<Button>(); ActionButton.targetGraphic = ActionButtonImage; ActionButton.onClick.AddListener(() => OnActionButtonClick(Action)); CharacterActionIcons.Add (ActionObject); }
void MoveTowardCurrentAction (float currentTime, CharacterAction current, CharacterAction previous) { if (current.node == 0) { transform.position = path.GetPositionAfterIndice (previous == null ? 0 : previous.node, Mathf.InverseLerp (previous == null ? 0f : GetActionEndTime (previous), current.startTime, currentTime)); return; } float moveStart = 0f; if (previous != null) moveStart = GetActionEndTime(previous); float moveEnd = current.startTime; transform.position = path.GetPositionBetweenIndices(previous == null ? 0 : previous.node, current.node, Mathf.InverseLerp(moveStart, moveEnd, currentTime)); }
public void AddAction(CharacterAction newAction) { allowedActions.Add(newAction.name, newAction); }
public void SetObjectAnimationLoop(CharacterAction action) { SetAnimation(action.ToString()); }
public void SetObjectAnimationNoLoop(CharacterAction action) { SetSequenceAnimations(action.ToString(), "stand"); }
public virtual void SetCurrentAction( CharacterAction newAction ) { if ( newAction == currentAction ) return; switch ( newAction ) { case CharacterAction.Waiting: case CharacterAction.None: _animator.SetInteger( _hashes.currentAction, 0 ); break; case CharacterAction.Carrying: _animator.SetInteger(_hashes.currentAction, 1); break; case CharacterAction.Pushing: _animator.SetInteger(_hashes.currentAction, 2); break; case CharacterAction.Climbing: _animator.SetInteger(_hashes.currentAction, 3); break; case CharacterAction.Boosting: _animator.SetInteger(_hashes.currentAction, 4); break; case CharacterAction.UsingLever: _animator.SetInteger(_hashes.currentAction, 5); break; case CharacterAction.Jumping: _animator.SetInteger(_hashes.currentAction, 6); break; case CharacterAction.Pulling: _animator.SetInteger(_hashes.currentAction, 7); break; } currentAction = newAction; }
public void addAction(CharacterAction a) { actions.Add (a); }
public bool OnEntitySelection(Entity entity) { if (entity.GetEntityType() == "Tile") currentAction = allowedActions["Move"]; if (currentAction.ValidateSelection(entity) == false) { return false; } currentAction.PreformAction(entity); currentAction = fallbackAction; return true; }
/* * Metode que executa les accions que s'han ordenat al Player, (Agafar, Conversar, etc) * que requereixen de varies operacions i/o comprovacions */ private void ExecuteAction() { switch(_characterAction) { //Anar fins a l'objecte, i afegirlo al inventari case CharacterAction.Take: if(Vector3.Distance(navi.transform.position, targetLocation)<0.5){ targetLocation = navi.transform.position; _inventory.Add2(targetObject); targetObject = null; _characterAction = CharacterAction.None; } break; //Anar fins al interlocutor, posarnos davant d'ell cara a cara, fer el transfer a la camara de dialeg //i llançar el dialeg case CharacterAction.Dialog: Vector3 agentPos = new Vector3(navi.transform.position.x,0,navi.transform.position.z); //Si el Player esta 2 unitats davant del seu interlocutor, ha de girar fins estar cara a cara amb ell if(Vector3.Distance(agentPos, targetLocation)<0.1){ targetLocation = agentPos; targetRotation = Quaternion.LookRotation(new Vector3(targetObject.transform.position.x,0,targetObject.transform.position.z)-targetLocation); //Si el Player mira cara a cara el seu interlocutor, es fa el transfer de camera, sino gira fins mirar el seu interlocutor if(navi.transform.rotation == targetRotation){ CCScript.TransferIn(targetObject.GetComponentInChildren<Camera>()); targetObject = null; _characterAction = CharacterAction.None; } else{ navi.transform.rotation = Quaternion.Lerp(navi.transform.rotation, targetRotation,Time.time * 0.002f); } } break; } }
/// <summary> /// Sets the action. /// </summary> /// <param name="characterAction">The character action.</param> public void SetAction(CharacterAction characterAction) { this.Action = characterAction; }
void SetAction(CharacterAction npcAction) { currentAction = npcAction; }
void SetAction (CharacterAction action, bool start) { #if UNITY_EDITOR if (start) print (gameObject.name + " starts to " + action.actionName); else print (gameObject.name + " stops to " + action.actionName); #endif if (start) anim.ResetTrigger ("Walk"); else anim.SetTrigger ("Walk"); if (action.takeItemInHolder && action.itemSlot != "None") SetItemSlotHolded (action.itemSlot, start); Item item = null; var slot = slotRecord.GetSlot (action.itemSlot); if (slot != null) item = slot.currentItem; if (start) { if (action.animPlayed != "None") anim.SetTrigger (action.animPlayed); } MadnessConsequencesTable.Severity severity = MadnessConsequencesTable.Severity.None; if (!start && item != null) { severity = csqTable.GetSwapSeverity (action.itemSlot, item.itemName); GainMadness (csqTable.SeverityToMadnessAmount (severity)); } PlayActionSound (action, start, item, severity); actionStarted = start; }
// Use this for initialization void Start( ) { m_action = GetComponentInParent<CharacterAction>(); }
public void Setup(string name, int baseHealth, int baseArmour, int actions, Guid guid, int Team) { allowedActions = new Dictionary<string, CharacterAction>(); offensiveActions = new List<SpellAction>(); var moveAct = new MoveAction(); moveAct.Setup(this, 3); moveAct.name = "Move"; currentAction = moveAct; allowedActions.Add("Move", moveAct); this.guid = guid; this.Health = baseHealth; this.Armour = baseArmour; actionPoints = actions; team = Team; }
void PlayActionSound (CharacterAction action, bool atStart, Item item, MadnessConsequencesTable.Severity madnessSeverity) { if (atStart) { if (item != null && item.OverrideSound (soundMgr, soundSrc [0], action.animDuration)) return; if (action.soundPlayed != "None") soundMgr.PlaySoundForDurtation (soundSrc [0], action.soundPlayed, action.animDuration); } else { string madsound = soundsMadnessConsequences[(int)madnessSeverity]; if (madsound != "None") soundMgr.PlaySound (soundSrc [1], madsound); } }
float GetActionEndTime (CharacterAction action) { return action.startTime + action.animDuration * timeLine.speed; }