private void Awake() { fsmPlyer = this.gameObject.GetComponent <FSMPlayer>(); skillCheckInfo = new SkillCheckInfo[(int)SkillType.MAX]; ClearAllCoolTime(); }
public void OnOrcaAttack2() { Transform Attack2Point = GameObject.Find("Attack2Point").transform; Attack2Point.position = new Vector3(Attack2Point.transform.position.x, Attack2Point.transform.position.y, Attack2Point.transform.position.z); MemoryPoolManager.Instance.CreateObject("OrcaEffect", Attack2Point.position, new Quaternion(0, 0, 0, 0)); int layerMask; string PlayerLayer = "Player"; layerMask = LayerMask.GetMask(PlayerLayer); Collider[] colliders = Physics.OverlapSphere(Attack2Point.position, 4.0f, layerMask); for (int i = 0; i < colliders.Length; ++i) { FSMPlayer player = colliders[i].GetComponent <FSMPlayer>(); if (!player.IsInvicibility) { player.TakeDamage(250); } } }
protected override void Awake() { base.Awake(); player = GameSceneManager.Instance.Player; Health = this.GetComponent <EnemyHealth>(); NavMesh = GetComponent <NavMeshAgent>(); NavMesh.speed = State.RunSpeed; NavMesh.angularSpeed = State.TurnSpeed; Sphere = GameObject.Instantiate(MinimapSphere) as GameObject; Sphere.transform.parent = this.transform; Sphere.transform.localPosition = new Vector3(0, 0, 0); stringBuilder = new StringBuilder(64); if (this.transform.Find("Dummy_root")) { DummyRoot = this.transform.Find("Dummy_root").transform; } for (int i = 0; i < Colliders.Length; ++i) { Colliders[i].enabled = false; } }
// Use this for initialization void Start() { enemy = GetComponent <FSMEnemy>(); colliders = enemy.Colliders; player = GameSceneManager.Instance.Player; stringBuilder = new StringBuilder(64); }
private void Awake() { if (GameObject.FindGameObjectWithTag("Player")) { player = GameObject.FindGameObjectWithTag("Player").GetComponent <FSMPlayer>(); } currentScene = SceneManager.GetActiveScene(); Invoke("Init", 0.02f); }
public override bool Execute(GameObject target) { FSMPlayer player = target.GetComponent <FSMPlayer>(); if (player != null) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit HitInfo; if (Physics.Raycast(ray, out HitInfo, 100f, player.Layer)) { int layer = HitInfo.transform.gameObject.layer; //클릭한 레이어의 값 if (layer == LayerMask.NameToLayer(player.clickLayer)) //땅을 클릭했을 때 { Vector3 dest = HitInfo.point; //마우스로 찍은 위치 player.Point.transform.position = dest; if (!player.IsWhirlwind()) { player.SetState(CH_STATE.Run); //휠윈드 상태가 아닐 때는 달리자 } return(true); } else if (layer == LayerMask.NameToLayer(player.enemyLayer)) //적을 클릭 했을 때 { player.Enemy = HitInfo.collider.GetComponent <FSMEnemy>(); //적의 컴퍼넌트를 가져온다. player.Point.SetParent(player.Enemy.transform); player.Point.transform.localPosition = Vector3.zero; if (!player.IsWhirlwind() && !player.Enemy.IsDead()) { if (Vector3.Distance(player.transform.position, player.Point.transform.position) <= player.State.AttackRange) { player.SetState(CH_STATE.Attack); } else { player.SetState(CH_STATE.AttackRun); } } return(false); } } } return(true); }
// private Jump jump; void Start() { fsm = GetComponent <FSMPlayer>(); m_Collider = GetComponent <Collider>(); rb = GetComponent <Rigidbody>(); //abstand zum boden distanceToGround = m_Collider.bounds.extents.y; playerStartRotation = transform.rotation; lookRight = transform.rotation; lookLeft = lookRight * Quaternion.Euler(0, 180, 0); gH = GetComponent <GrapplingHook>(); // rb.freezeRotation = true; }
private void Awake() { fsmPlyer = this.gameObject.GetComponent <FSMPlayer>(); followingCamera = this.transform.Find( CommonObjectName.SurroundingsOfCharacter.FOLLOWING_CAMERA).gameObject; // Seting Following Camera if (followingCamera == null) { followingCamera = new GameObject(); followingCamera.name = CommonObjectName.SurroundingsOfCharacter.FOLLOWING_CAMERA; followingCamera.transform.parent = this.gameObject.transform; followingCamera.transform.position = CommonObjectValue.DefaultPosition.FOLLOWING_CAMERA; followingCamera.transform.rotation = CommonObjectValue.DefaultRotation.FOLLOWING_CAMERA; } }
public void OnIceAge() { MemoryPoolManager.Instance.CreateObject("IceAge", this.transform); int layerMask; string PlayerLayer = "Player"; layerMask = LayerMask.GetMask(PlayerLayer); Collider[] colliders = Physics.OverlapSphere(this.transform.position, 6.0f, layerMask); for (int i = 0; i < colliders.Length; ++i) { FSMPlayer player = colliders[i].GetComponent <FSMPlayer>(); player.TakeDamage(player.Health.maxHP.Value); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { FSMPlayer player = other.GetComponent <FSMPlayer>(); if (player != null) { if (player.IsAvoid()) { return; } if (player.IsDead()) { return; } if (player.IsInvicibility) { return; } if (Name != null) { MemoryPoolManager.Instance.CreateObject(Name, transform); } player.TakeDamage(AttackDamage); this.gameObject.SetActive(false); } } //For Plasma if (isGroundCollision) { if (other.gameObject.layer == 8) { MemoryPoolManager.Instance.CreateObject("Plasma", transform); this.gameObject.SetActive(false); } } }
public FSMPlayer Initialize(PlayerCharacter player) { FSMPlayer fsmCopy = Instantiate(this); for (int i = 0; i < serializedStates.Length; ++i) { PlayerState stateCopy = Instantiate(serializedStates[i]); stateCopy.Initialize(i, player); fsmCopy.states.Add(stateCopy.Name, stateCopy); } foreach (var kv in states) { Debug.Log(kv.Key.ToString() + " - " + kv.Value.Name); } fsmCopy.currentStateName = ""; return(fsmCopy); }
public static void LoadData() { if (!System.IO.File.Exists(Application.dataPath + "/Resources/PlayerData.xml")) { return; } XmlDocument XmlDoc = new XmlDocument(); XmlDoc.Load(Application.dataPath + "/Resources/PlayerData.xml"); XmlElement XmlEl = XmlDoc["PlayerDB"]; FSMPlayer player = GameSceneManager.Instance.Player; foreach (XmlElement ItemElement in XmlEl.ChildNodes) { player.Health.HP = System.Convert.ToSingle(ItemElement.GetAttribute("CurrentHP")); player.Mana.MP = System.Convert.ToSingle(ItemElement.GetAttribute("CurrentMP")); player.Gold = System.Convert.ToInt32(ItemElement.GetAttribute("Gold")); } }
public static void SaveData() { FSMPlayer player = GameSceneManager.Instance.Player; XmlDocument XmlDoc = new XmlDocument(); XmlElement XmlEl = XmlDoc.CreateElement("PlayerDB"); XmlDoc.AppendChild(XmlEl); XmlElement ElementSetting = XmlDoc.CreateElement("Player"); int HP = (int)player.Health.HP; int MP = (int)player.Mana.MP; ElementSetting.SetAttribute("CurrentHP", HP.ToString()); ElementSetting.SetAttribute("CurrentMP", MP.ToString()); ElementSetting.SetAttribute("Gold", player.Gold.ToString()); XmlEl.AppendChild(ElementSetting); XmlDoc.Save(Application.dataPath + "/Resources/PlayerData.xml"); }
public void init() { player = Player.CurrentPlayer == null?Player.CreatePlayer() : Player.CurrentPlayer; statistics = new StatisticSystem(player.attributes, player.inventory); ResetStatistics(); OnStatisticChange = statistics.onStatisticChange; SpriteHolder.GetComponent <SpriteRenderer>().color = Color.white; rigidbody = GetComponent <Rigidbody2D>(); TimeManager.Instance.endSlowMotion(); fsm = fsm.Initialize(this); fsm.Boot(); //GUIManager.Singleton.Open("MainMenu", this); //StartDialogue(10102001); }
private void Start() { player = GameSceneManager.Instance.Player; }
private void Awake() { player = GameSceneManager.Instance.Player; }
void Start() { player = GetComponent <FSMPlayer>(); }
// Use this for initialization void Start() { Player = GameSceneManager.Instance.Player; }