bool NetworkObjectCheck() { if (m_tutorial) { if (m_pattern == null) { m_pattern = new MonsterPattern(m_skeletonAnimation, ANI_MOVE, ANI_ATTACK, null); m_skeletonAnimation.state.Complete += State_Complete; } return(true); } if (m_isNetworkObject) { return(false); } if (m_networkObjectCheck) { return(true); } if (GameManager.Instance().m_curSceneState.Equals("play") && NetworkOrderController.ORDER_NAME.Equals(GameManager.Instance().PLAYER.USER_NAME)) { Vector3 pos = transform.position; m_name = "monster_" + GameManager.Instance().PLAYER.USER_NAME + "_" + this.GetHashCode(); string dataName = m_skeletonAnimation.skeletonDataAsset.name; if (dataName.Equals("mon2_SkeletonData")) { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCreateOrder(m_name, "monster1", pos.x, pos.y, -1.0f)); } else if (dataName.Equals("mon3_SkeletonData")) { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCreateOrder(m_name, "monster2", pos.x, pos.y, -1.0f)); } else if (dataName.Equals("mon_space1_SkeletonData")) { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCreateOrder(m_name, "SpaceMonster1", pos.x, pos.y, -1.0f)); } else if (dataName.Equals("mon_space2_SkeletonData")) { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCreateOrder(m_name, "SpaceMonster2", pos.x, pos.y, -1.0f)); } ///행성 몹 else if (dataName.Equals("mon_planet1_SkeletonData")) { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCreateOrder(m_name, "PlanetMonster1", pos.x, pos.y, -1.0f)); m_curAttackType = AttackType.MOVE_AND_ATTACK; } else if (dataName.Equals("mon_planet3_SkeletonData")) { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCreateOrder(m_name, "PlanetMonster3", pos.x, pos.y, -1.0f)); m_curAttackType = AttackType.MOVE_AND_ATTACK; } NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonOrderStateValueChange(m_name, m_hp)); MoveSend(); NetworkManager.Instance().AddNetworkOrderMessageEventListener(this); m_networkObjectCheck = true; m_pattern = new MonsterPattern(m_skeletonAnimation, ANI_MOVE, ANI_ATTACK, m_name); m_skeletonAnimation.state.Complete += State_Complete; return(true); } else if (!string.IsNullOrEmpty(NetworkOrderController.ORDER_NAME) && !string.IsNullOrEmpty(GameManager.Instance().PLAYER.USER_NAME) && !NetworkOrderController.ORDER_NAME.Equals(GameManager.Instance().PLAYER.USER_NAME)) { GameObject.Destroy(gameObject); } return(false); }
// Use this for initialization void Awake() { monsterPattern = gameObject.GetComponent<MonsterPattern>(); }