public IEnumerator SetAction(Avatar.VCharacterBase vCharacter, Model.ActionType action) { //MapMoveToPosition(mCharacter.CoordinateX, mCharacter.CoordinateY); vCharacter.action = action; if (vCharacter.action != Model.ActionType.idle && vCharacter.action != Model.ActionType.move) { while (vCharacter.action == action) { yield return(new WaitForEndOfFrame()); } } Util.LSharp.LSharpScript.Instance.Analysis(); }
private void MoveCharacter(Avatar.VCharacterBase vCharacter, int x, int y) { //MapMoveToPosition(mCharacter.CoordinateX, mCharacter.CoordinateY); Holoville.HOTween.Core.TweenDelegate.TweenCallback moveComplete = () => { vCharacter.action = Model.ActionType.idle; App.Util.LSharp.LSharpScript.Instance.Analysis(); }; vCharacter.action = Model.ActionType.move; Sequence sequence = new Sequence(); TweenParms tweenParms = new TweenParms().Prop("X", x * 0.32f, false) .Prop("Y", -4.4f, false).Ease(EaseType.Linear); tweenParms.OnComplete(moveComplete); sequence.Append(HOTween.To(vCharacter, 1f, tweenParms)); sequence.Play(); }
void AddCharacterHandler(int npcId, App.Model.ActionType actionType, App.Model.Direction direction, int x, int y, bool isPlayer) { Debug.LogError("VScenarioMap AddCharacterHandler"); Model.Character.MCharacter character = NpcCacher.Instance.GetFromNpc(npcId); character.StatusInit(); character.action = actionType; GameObject obj = character.staticAvatar == 0 ? Instantiate(Global.characterPrefab) : Instantiate(Global.avatarPrefab); obj.transform.SetParent(characterLayer); obj.transform.localScale = Vector3.one * 0.6f; //float x = character.coordinate.x * 0.64f + 0.32f + (character.coordinate.y % 2 == 0 ? 0 : 0.32f); obj.transform.localPosition = new Vector3(x * 0.32f, -4.4f, 0); obj.SetActive(true); Avatar.VCharacterBase vCharacter = obj.GetComponent <Avatar.VCharacterBase>(); vCharacter.UpdateView(character); vCharacter.direction = direction; Global.charactersManager.vCharacters.Add(vCharacter); if (isPlayer) { Global.charactersManager.mainVCharacter = vCharacter; } }
private void SetCharacters() { object val = this.GetByPath("characters"); if (val == null) { return; } List <Model.Character.MCharacter> characters = val as List <Model.Character.MCharacter>; for (int i = 0; i < characters.Count; i++) { Model.Character.MCharacter character = characters[i]; Debug.LogError("character=" + character.name + "," + character.staticAvatar); GameObject obj = character.staticAvatar == 0 ? Instantiate(Global.characterPrefab) : Instantiate(Global.avatarPrefab); obj.transform.SetParent(characterLayer); obj.transform.localScale = Vector3.one * 0.6f; float x = character.coordinate.x * 0.64f + 0.32f + (character.coordinate.y % 2 == 0 ? 0 : 0.32f); obj.transform.localPosition = new Vector3(x, -character.coordinate.y * 0.64f - 0.32f, 0); Avatar.VCharacterBase vCharacter = obj.GetComponent <Avatar.VCharacterBase>(); vCharacter.UpdateView(character); Global.charactersManager.vCharacters.Add(vCharacter); } }
void MoveNpcHandler(int npcId, int x, int y) { Avatar.VCharacterBase vCharacter = Global.charactersManager.vCharacters.Find(chara => chara.mCharacter.id == npcId); MoveCharacter(vCharacter, x, y); }
void SetNpcActionHandler(int npcId, Model.ActionType actionType) { Avatar.VCharacterBase vCharacter = Global.charactersManager.vCharacters.Find(chara => chara.mCharacter.id == npcId); StartCoroutine(SetAction(vCharacter, actionType)); }