private void OnTriggerEnter(Collider col) { if (col.gameObject.tag.Equals("User_Mineral")) { m_unitType.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_SCV_STOP); } }
private void OnTriggerEnter(Collider col) { if (col.gameObject.tag.Equals("Enemy_Sight")) { Debug.Log("충돌"); m_unitType.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_PAUSE); m_mapcreater.HeroMapTile(); } }
private void ScvMineralMove() { if (m_scvType.GetStatusType().Equals(CommonTypes.StatusType.STATUS_TYPE_SCV_NONE)) { int m_mineral_random_point = Random.Range(-1, 3); m_mineralPoint = m_objectList.GetMapGameObject().GetMineralPoint(m_mineral_random_point); if (m_mineralPoint == null) { return; } m_scvType.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_SCV_PLAY); } else if (m_scvType.GetStatusType().Equals(CommonTypes.StatusType.STATUS_TYPE_SCV_PLAY)) { Vector3 targetPos = new Vector3(m_mineralPoint.transform.position.x, m_mineralPoint.transform.position.y, m_mineralPoint.transform.position.z); Vector3 movePos = Vector3.MoveTowards(m_scvObject.transform.position, targetPos, Time.deltaTime * 30f); m_scvObject.transform.position = movePos; } }
public bool First_SightColliderCheck() { if (m_unitType == null || m_colObj == null) { return(false); } else if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_USER) && m_colObj.tag.Equals("Enemy_Sight")) { // Now is Object User m_UserSightList.Add(m_colObj.transform.parent); m_unitType.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_PAUSE); return(true); } else if (m_unitType.GetCreatureType().Equals(CommonTypes.MinionTeam.MINION_TEAM_ENEMY) && m_colObj.tag.Equals("User_Sight")) { // Now is Object Enmey m_EnemySighttList.Add(m_colObj.transform.parent); m_unitType.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_PAUSE); return(true); } return(true); }
// Use this for initialization private void UnitObjectCreate(string prefabsName, int unique_id, string unitType, int hp, int attack, float attackSpeed, float moveSpeed, CommonTypes.MinionTeam miniontype) { string prefabsPath = "prefabs/Unit/" + prefabsName; GameObject prefabsLoad = Resources.Load(prefabsPath) as GameObject; if (prefabsLoad == null) { return; } GameObject unitProduceObject = Instantiate(prefabsLoad) as GameObject; if (unitProduceObject == null) { return; } unitProduceObject.transform.parent = this.transform; unitProduceObject.name = prefabsName + "_" + unique_id; Creature_p creatureScript = unitProduceObject.transform.GetComponent <Creature_p>(); if (creatureScript == null) { return; } int childCount = unitProduceObject.transform.GetChildCount(); if (childCount == 4) { GameObject hpobject = unitProduceObject.transform.GetChild(3).transform.gameObject; if (hpobject == null) { return; } Slider HpBar = hpobject.transform.GetComponent <Slider>(); if (HpBar == null) { return; } HpBar.maxValue = hp; HpBar.value = HpBar.maxValue; } switch (unitType) { case "Hero": creatureScript.SetUniqueIndex(unique_id); creatureScript.SetCreatureType(miniontype); creatureScript.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_PLAY); creatureScript.SetAttackType(CommonTypes.AttackType.ATTACK_TYPE_NONE); //creatureScript.SetCollisionType(CommonTypes.CollisionType.COLLISION_TYPE_NONE); creatureScript.SetGameStatusType(CommonTypes.GameStatusType.GAMESTATUS_TYPE_NONE); unitProduceObject.GetComponent <HeroUnit_c>().SetUserUnitHP(hp); unitProduceObject.GetComponent <HeroUnit_c>().SetUserUnitAttack(attack); unitProduceObject.GetComponent <HeroUnit_c>().SetUserUnitAttackSpeed(attackSpeed); unitProduceObject.GetComponent <HeroUnit_c>().SetUserUnitMoveSpeed(moveSpeed); m_objectList.GetUnitGameObject().SetUnitGameObject(unique_id, ref unitProduceObject); break; case "Nomal": break; case "SCV": creatureScript.SetUniqueIndex(unique_id); creatureScript.SetCreatureType(miniontype); creatureScript.SetStatusType(CommonTypes.StatusType.STATUS_TYPE_SCV_NONE); creatureScript.SetAttackType(CommonTypes.AttackType.ATTACK_TYPE_NONE); //creatureScript.SetCollisionType(CommonTypes.CollisionType.COLLISION_TYPE_NONE); creatureScript.SetGameStatusType(CommonTypes.GameStatusType.GAMESTATUS_TYPE_NONE); break; } }