//Constructor public Monster() { for (int i = 0; i < statArray.Length; i ++) { statArray[i] = new MonsterStat(); } }
protected virtual void Awake() { _controller = GetComponentInChildren <CharacterController>(); _renderer = _controller.gameObject.GetComponent <Renderer>(); _anim = GetComponentInChildren <Animator>(); _stat = GetComponent <MonsterStat>(); }
private void Awake() { WaitSec = 0; _Boss = GameObject.FindGameObjectWithTag("Boss").GetComponent <MonsterStat>(); hp = BMHPBar.GetComponent <RectTransform>(); shp = BMSHPBar.GetComponent <RectTransform>(); }
private void Awake() { CreateSignNumber(); mon = new MonsterStat(); myStats.Name = "SquidTurtle"; myStats.Force = mon.Force + MBForce; myStats.Vitality = mon.Vitality + MBVitality; myStats.Agility = mon.Agility + MBAgility; myStats.Fortiude = mon.Fortiude + MBFortitude; myStats.Intellect = mon.Intellect + MBIntellect; myStats.Rationale = mon.Rationale + MBRational; myStats.Charisma = mon.Charisma + MBCharima; myStats.HealthPoints = (myStats.Vitality + myStats.Fortiude + HPMod) / 2; myStats.AbilityPoints = (myStats.Force + myStats.Intellect + APMod) / 2; myStats.Defence = myStats.Vitality + DFMod; myStats.AttackDamage = myStats.Force + ADMod; myStats.AttackSpeed = myStats.Agility; myStats.MagicDefence = myStats.Rationale + MDMod; myStats.AttackBar = 0 / 100; //HPthing myStats.MaximumHealthPoints = myStats.HealthPoints; myStats.HealthPoints = myStats.MaximumHealthPoints; //clamps it myStats.HealthPoints = Mathf.Clamp(myStats.HealthPoints, 0, myStats.MaximumHealthPoints); // AP bar increasre by timesing agility by time.deltatime // divide delta time * agility by 32 }
public override void Init() { WorldObjectType = Define.WorldObject.Monster; gameObject.layer = (int)Define.Layer.Monster; // 몬스터 스텟 정보 가져오기 Stat = gameObject.GetOrAddComponent <MonsterStat>(); // 몬스터 공속 설정 Animator monsterAnimator = GetComponent <Animator>(); monsterAnimator.SetFloat("AttackSpeed", Stat.AttackSpeed); // NavMeshAgent nma = Util.GetOrAddComponent <NavMeshAgent>(gameObject); // FOV 가져오기 _fov = gameObject.GetOrAddComponent <FieldOfView>(); _fov.targetMask = (1 << (int)Define.Layer.Player); // HP바 가져오기 if (gameObject.GetComponentInChildren <UI_HPBar>() == null) { Managers.UI.MakeWorldSpaceUI <UI_HPBar>(transform); } }
/// <summary> /// Initializes a new instance of the <see cref="Creature"/> class. /// </summary> public Creature() { this.initTiebreaker = rand.Next(); this.monster = MonsterStat.BlankMonsterStat(); this.hp = this.monster.HitPoints; this.maxHp = this.monster.HitPoints; }
private void Awake() { _cc = GetComponent <CharacterController>(); _stat = GetComponent <MonsterStat>(); _anim = GetComponentInChildren <Animator>(); _sight = GetComponentInChildren <Camera>(); _playercc = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterController>(); _playerTransform = _playercc.transform; _target = GameObject.FindGameObjectWithTag("Player").transform; MonsterState[] stateValues = (MonsterState[])System.Enum.GetValues(typeof(MonsterState)); foreach (MonsterState s in stateValues) { System.Type FSMType = System.Type.GetType("Monster" + s.ToString()); MonsterFSMState state = (MonsterFSMState)GetComponent(FSMType); if (null == state) { state = (MonsterFSMState)gameObject.AddComponent(FSMType); } _states.Add(s, state); state.enabled = false; } }
public void Initialize(MonsterStat stat, GameObject monsterObj) { monsterStat = stat; MonsterObject = monsterObj; gameObject.SetActive(false); stat.Attach_ChangedCallback(ChangedStatus); }
public static void CreateMonsterStatAssetFile() { MonsterStat asset = CustomAssetUtility.CreateAsset <MonsterStat>(); asset.SheetName = "AbyssMonsterTable"; asset.WorksheetName = "MonsterStat"; EditorUtility.SetDirty(asset); }
void Start() { AudioSource audioSource = gameObject.GetComponent <AudioSource>(); audioSource.PlayOneShot(audioSource.clip); animator = gameObject.GetComponent <Animator>(); monsterStat = gameObject.GetComponent <MonsterStat>(); }
public override void SendDamage(int damage) { int mid = GetComponent <oNetworkIdentity>().id; FlatBufferBuilder fbb = new FlatBufferBuilder(1); fbb.Finish(MonsterStat.CreateMonsterStat (fbb, Class.MonsterStat, fbb.CreateString(""), -damage, 0, mid).Value); TCPClient.Instance.Send(fbb.SizedByteArray()); }
void Start() { AudioSource audioSource = gameObject.GetComponent <AudioSource>(); audioSource.PlayOneShot(audioSource.clip); animator = gameObject.GetComponent <Animator>(); monsterStat = gameObject.GetComponent <MonsterStat>(); // GameManager.instance = GameObject.Find("Game Manager").GetComponent<GameManager.instance>(); }
void LoadMonsterTable() { if (m_MonsterStatData != null) { return; } m_MonsterStatData = Resources.Load("Table/MonsterStat") as MonsterStat; }
protected void Init(int id) { MonsterTable table; if (TableManager.I.GetMonsterTable(id, out table) == false) { System.Diagnostics.Debug.Assert(false, "MonsterBoss Null"); } _stat = table.Stat; }
void Start () { mm = GetComponent<MonsterMovement> (); ms = GetComponent<MonsterStat> (); mas = GetComponent<MonsterAttackScript> (); Setup (); }
private void Awake() { // 플레이어 정보 가져오기 _player = GameObject.FindWithTag("Player").transform; //몬스터 스텟 정보 가져오기 _stat = GetComponent <MonsterStat>(); // 애니메이션 정보 가져오기 _ani = GetComponentInChildren <Animator>(); _aniParamID = Animator.StringToHash("CurrentState"); _aniManager = GetComponentInChildren <MonsterAniManager>(); //몬스터 상태, 행동들의 정보 가져오기 MonsterStates[] statesValues = (MonsterStates[])System.Enum.GetValues(typeof(MonsterStates)); MonsterActions[] actionValues = (MonsterActions[])System.Enum.GetValues(typeof(MonsterActions)); //몬스터 상태 스크립트 foreach (MonsterStates s in statesValues) { System.Type StateType = System.Type.GetType("Monster" + s.ToString("G") + "State"); MonsterState state = (MonsterState)GetComponentInChildren(StateType); if (state == null) { state = (MonsterState)transform.Find("StateScript").gameObject.AddComponent(StateType); } state.enabled = false; _states.Add(s, state); } //몬스터 행동 스크립트 foreach (MonsterActions a in actionValues) { System.Type ActionType = System.Type.GetType("Monster" + a.ToString("G")); MonsterAction action = (MonsterAction)GetComponent(ActionType); if (action == null) { action = (MonsterAction)transform.Find("ActionScript").gameObject.AddComponent(ActionType); } action.enabled = false; _actions.Add(a, action); } //행동 바꾸는 코루틴 _actionChangeCoroutine = this.ChangeState(); //몬스터 이동 코루틴 _moveCoroutine = this.monsterMove(); /* 네브메쉬 셋팅 */ _Agent = GetComponent <NavMeshAgent>(); }
public static Offset <MonsterStat> CreateMonsterStat(FlatBufferBuilder builder, Class cType = Class.Base, int HP = 0, int ID = 0) { builder.StartObject(3); MonsterStat.AddID(builder, ID); MonsterStat.AddHP(builder, HP); MonsterStat.AddCType(builder, cType); return(MonsterStat.EndMonsterStat(builder)); }
int movementFlag = 0; //0 Idle , 1 move public override void Init() { WorldObjectType = Define.WorldObject.Monster; _rigidbody = gameObject.GetComponent <Rigidbody>(); _stat = gameObject.GetComponent <MonsterStat>(); //최초 발결 된 것. if (gameObject.GetComponentInChildren <UI_HPBar>() == null) { Managers.UI.MakeWorldSpaceUI <UI_HPBar>(transform); } }
// Start is called before the first frame update void Start() { scale = image.transform.localScale.x; if (parent.name.Contains("Character")) { characterStat = parent.GetComponent <CharacterStat>(); } else if (parent.name.Contains("Monster")) { monsterStat = parent.GetComponent <MonsterStat>(); } }
//Function called to update stats after level has changed private void UpdateStats() { //Calculate HP first as it uses a different formula m_FinalStats[MonsterStat.HP] = ((m_BaseStats[MonsterStat.HP] + m_IValues[MonsterStat.HP]) * 2 + (Mathf.Sqrt(m_EValues[MonsterStat.HP]) / 4)) * m_Level / 100 + m_Level + 10; //Iterate through other stats and update them with slightly differnt formula for (MonsterStat it = MonsterStat.ATTACK; it != MonsterStat.STAT_COUNT; ++it) { m_FinalStats[it] = ((m_BaseStats[it] + m_IValues[it]) * 2 + (Mathf.Sqrt(m_EValues[it]) / 4)) * m_Level / 100 + 5; } }
void Start() { scale = image.transform.localScale.x; characterStat = character.GetComponent <CharacterStat>(); if (parent.name.Contains("Character")) // 부모 객체 의 문자열이 Character 가 포함 되어 있을 경우 { characterStat = parent.GetComponent <CharacterStat>(); // 캐릭터의 정보를 불러옴 } else if (parent.name.Contains("Monster")) // 부모 객체 의 문자열이 Monster 가 포함 되어 있을 경우 { monsterStat = parent.GetComponent <MonsterStat>(); // 몬스터의 정보를 불러옴 } }
/// <summary> /// Apply stat changes to monster. /// </summary> /// <remarks>Range is -6 to 6.</remarks> /// <param name="statChanges">Changes to apply.</param> public void ApplyStatChanges(List <StatChange> statChanges) { foreach (StatChange statChange in statChanges) { MonsterStat stat = statChange.stat; int changeVal = statChange.changeVal; StatsChanged[stat] = Mathf.Clamp(StatsChanged[stat] + changeVal, -6, 6); StatusChanges.Enqueue(changeVal > 0 ? $"{Base.Name}'s {stat} increased!" : $"{Base.Name}'s {stat} decreased!"); } }
public void Updater(GameObject Obj) { int id = Obj.GetComponent <oNetworkIdentity>().id; oCreature oCreature = Obj.GetComponent <oCreature>(); var fbb = new FlatBufferBuilder(1); if (Obj.GetComponent <oNetworkIdentity>().type == oNetworkIdentity.ObjType.monster) { fbb.Finish(MonsterStat.CreateMonsterStat(fbb, Class.MonsterStat, fbb.CreateString(""), oCreature.CurrentHP.Value, 0, id ).Value); } else if (Obj.GetComponent <oNetworkIdentity>().type == oNetworkIdentity.ObjType.player) { if (id != BPlayer.MainPlayer.GetComponent <NetworkObject>().id) { fbb.Finish(PlayerStat.CreatePlayerStat(fbb, Class.PlayerStat, oCreature.CurrentHP.Value, oCreature.MaximumHP, oCreature.CurrentSP, oCreature.MaximumSP, 0, 0, oCreature.Lv, id ).Value); } else { var player = BPlayer.MainPlayer.GetComponent <NetworkObject>(); fbb.Finish(PlayerStat.CreatePlayerStat( fbb, Class.PlayerStat, player.m_CurrentHP.Value, MaxStatManager.MAX_HP, player.m_CurrentMP.Value, MaxStatManager.MAX_MP, player.m_CurrentEXP.Value, player.m_CurrentATK.Value, oCreature.Lv, id ).Value); } } TCPClient.Instance.Send(fbb.SizedByteArray()); }
public static string writeSMonCS(MonsterStat mon) { var vname = mon.name.Replace(" ", "").Replace("(", "_").Replace(")", "_").Replace("-", "").Replace("'", "") + "_" + mon.element; string s = $@" private static {nameof(MonsterStat)} _{vname} = null; public static {nameof(MonsterStat)} {vname} {{ get {{ if (_{vname} == null) _{vname} = {nameof(StatReference)}.AskSWApi<{nameof(MonsterStat)}>(""{mon.URL}""); return _{vname}; }} }}" ; return(s); }
void button4_Click_1(object sender, EventArgs e) { btnDL6star.Enabled = false; var mref = MonsterStat.FindMon(Build.Mon); if (mref != null) { var mstat = mref.Download(); var newmon = mstat.GetMon(Build.Mon); Build.Mon = newmon; refreshStats(newmon, newmon.GetStats()); } btnDL6star.Enabled = true; }
/// <summary> /// Initializes a new instance of the <see cref="Creature"/> class. /// </summary> /// <param name="monster">A monster stat</param> /// <param name="rollHitPoints">the hit points are rolled</param> public Creature(MonsterStat monster, bool rollHitPoints) : this() { this.monster = (MonsterStat)monster.Clone(); this.name = this.monster.Name; if (!rollHitPoints || !this.TryParseHitPoints()) { this.hp = monster.HitPoints; } this.maxHp = this.hp; this.isMonster = true; }
private int GetStat(MonsterStat stat) { int statVal = Stats[stat]; // Stat changes based on original game's formula. int changeVal = StatsChanged[stat]; float[] changeVals = { 1f, 1.5f, 2f, 2.5f, 3f, 3.5f, 4f }; statVal = changeVal >= 0 ? Mathf.FloorToInt(statVal * changeVals[changeVal]) : Mathf.FloorToInt(statVal / changeVals[-changeVal]); return(statVal); }
public static string writeMonCS(MonsterStat mon) { string s = $@" public static {nameof(MonsterStat)} {mon.name.Replace(" ", "").Replace("(", "_").Replace(")", "_").Replace("-", "").Replace("'", "")}_{mon.element} = new {nameof(MonsterStat)}() {{ {nameof(mon.URL)} = ""{mon.URL}"", {nameof(mon.pk)} = {mon.pk}, {nameof(mon.name)} = ""{mon.name}"", {nameof(mon.monsterTypeId)} = {mon.monsterTypeId}, {nameof(mon.imageFileName)} = ""{mon.imageFileName}"", {nameof(mon.element)} = {nameof(Element)}.{mon.element}, {nameof(mon.Health)} = {mon.Health}, {nameof(mon.Attack)} = {mon.Attack}, {nameof(mon.Defense)} = {mon.Defense}, {nameof(mon.CritRate)} = {mon.CritRate}, {nameof(mon.CritDamage)} = {mon.CritDamage}, {nameof(mon.Resistance)} = {mon.Resistance}, {nameof(mon.Accuracy)} = {mon.Accuracy}, {nameof(mon.archetype)} = {nameof(Archetype)}.{mon.archetype}, {nameof(mon.grade)} = {mon.grade}, {nameof(mon.isFusion)} = {mon.isFusion.ToString().ToLower()}, {nameof(mon.obtainable)} = {mon.obtainable.ToString().ToLower()}, {nameof(mon.Awakened)} = {mon.Awakened.ToString().ToLower()}, {nameof(mon.base_hp)} = {mon.base_hp}, {nameof(mon.base_attack)} = {mon.base_attack}, {nameof(mon.base_defense)} = {mon.base_defense}, {nameof(mon.Skills)} = new {nameof(SkillDef)}[] {{ {string.Join(@", ", mon.Skills.Select(sk => $@"new {nameof(SkillDef)}(){{ {nameof(sk.Pk)} = {sk.Pk}, {nameof(sk.Com2usId)} = {sk.Com2usId}, {nameof(sk.Name)} = ""{sk.Name}"", {nameof(sk.Cooltime)} = {(sk.Cooltime.HasValue ? sk.Cooltime.ToString() : "null")}, {nameof(sk.Hits)} = {(sk.Hits.HasValue ? sk.Hits.ToString() : "null")}, {nameof(sk.Passive)} = {sk.Passive.ToString().ToLower()}, {nameof(sk.LevelProgressDescription)} = ""{sk.LevelProgressDescription.Replace("\r","").Replace("\n","\\n")}"", {nameof(sk.MultiplierFormulaRaw)} = ""{sk.MultiplierFormulaRaw.Replace("\"", "\\\"")}"", {nameof(sk.SkillEffect)} = new {nameof(SkillEff)}[] {{ {string.Join(@", ", sk.SkillEffect.Select(skef => $@"new {nameof(SkillEff)}(){{ {nameof(skef.Name)} = ""{skef.Name}"", {nameof(skef.IsBuff)} = {skef.IsBuff.ToString().ToLower()}, }}"))} }} }}"))} }} }}; "; return(s); }
public static Offset <MonsterStat> CreateMonsterStat(FlatBufferBuilder builder, Class cType = Class.Base, StringOffset MonNameOffset = default(StringOffset), int HP = 0, int MAXHP = 0, int ID = 0) { builder.StartObject(5); MonsterStat.AddID(builder, ID); MonsterStat.AddMAXHP(builder, MAXHP); MonsterStat.AddHP(builder, HP); MonsterStat.AddMonName(builder, MonNameOffset); MonsterStat.AddCType(builder, cType); return(MonsterStat.EndMonsterStat(builder)); }
void button5_Click_1(object sender, EventArgs e) { btnDLawake.Enabled = false; var mref = MonsterStat.FindMon(build.Mon); if (mref != null) { var mstat = mref.Download(); if (!mstat.Awakened && mstat.AwakenTo != null) { mstat = mstat.AwakenTo.Download(); var newmon = mstat.GetMon(build.Mon); build.Mon = newmon; refreshStats(newmon, newmon.GetStats()); } } btnDLawake.Enabled = true; }
// Update is called once per frame void Update() { curDistance = Vector3.Distance(target.position, myTransform.position); PointDistance = Vector3.Distance(Point.position, myTransform.position); //если позволяет дистанция двигаемся к цели(проверка на минимальную дистанцию) if ((curDistance >= maxDistance) && (curDistance <= ReactionDistance)) { _monsterStat = MonsterStat.walkPlayer; } else if ((curDistance > ReactionDistance) && (PointDistance > 1)) { _monsterStat = MonsterStat.walkPoint; } else { _monsterStat = MonsterStat.idle; } switch (_monsterStat) { case MonsterStat.idle: animation.CrossFade(a_Idle.name); break; case MonsterStat.walkPlayer: // Разворачиваемся в сторону игрока myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime); //двигаемся к цели myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; animation.CrossFade(a_Walk.name); break; case MonsterStat.walkPoint: // Разворачиваемся в сторону игрока myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(Point.position - myTransform.position), rotationSpeed * Time.deltaTime); //двигаемся к цели myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime; animation.CrossFade(a_Walk.name); break; } }
void Update() { curDistance = Vector3.Distance (target.position, myTransform.position); PointDistance = Vector3.Distance (Point.position, myTransform.position); if((curDistance>=maxDistance) && (curDistance <= ReactionDistance)){ _monsterStat = MonsterStat.walkPlayer; } else if((curDistance > ReactionDistance) && (PointDistance > 1)) { _monsterStat = MonsterStat.walkPoint; } else{ _monsterStat = MonsterStat.idle; } switch(_monsterStat){ case MonsterStat.idle: Debug.DrawLine (target.position,myTransform.position,Color.yellow); animation.CrossFade(a_Idle.name); break; case MonsterStat.walkPlayer: Debug.DrawLine (target.position,myTransform.position,Color.red); myTransform.rotation = Quaternion.Slerp (myTransform.rotation,Quaternion.LookRotation(target.position - myTransform.position),rotationSpeed*Time.deltaTime); myTransform.position += myTransform.forward* moveSpeed * Time.deltaTime; animation.CrossFade(a_Walk.name); break; case MonsterStat.walkPoint: Debug.DrawLine (Point.position,myTransform.position,Color.green); Debug.DrawLine (target.position,myTransform.position,Color.yellow); myTransform.rotation = Quaternion.Slerp (myTransform.rotation,Quaternion.LookRotation(Point.position - myTransform.position),rotationSpeed*Time.deltaTime); myTransform.position += myTransform.forward* moveSpeed * Time.deltaTime; animation.CrossFade(a_Walk.name); break; } }
void reRollStat(int i) { string temp = statArray[i].getInherited(); temp += " - ReRolled"; statArray[i] = new MonsterStat(); statArray[i].setParent(temp); }