void OnAllScripts() { playerMotor = GetComponent <TP_Motor>(); playerAnimator = GetComponent <TP_Animator>(); playerInfo = GetComponent <TP_Info>(); gameObject.name = gameObject.name + photonView.viewID; /*playerCamera = transform.FindChild("Camera").gameObject;// transform.FindChild("Camera").gameObject; * playerAttack = transform.FindChild("AttackRangeCol").gameObject; * if(photonView.isMine) * { * playerCamera.SetActive(true); * playerAttack.SetActive(true); * playerCamera.transform.parent = transform.FindChild("targetLookAt").transform; * playerController.OnPlayerAttack(); * playerAnimator.OnPlayerAttack(); * } * else * { * playerCamera.gameObject.SetActive(false); * playerController.OnPlayerAttack(); * playerAnimator.OnPlayerAttack(); * playerAttack.gameObject.SetActive(true); * } * playerController.SetIsLocalPlayer(photonView.isMine);*/ }
public void CreateRole(int ID) { myRole = PhotonNetwork.Instantiate("Darkman Solider", Random.onUnitSphere * 5f, Quaternion.identity, 0); if (ID == 0) { playersInfo.myID = PhotonNetwork.room.playerCount; GameObject myPlayer = GameObject.Find("Player" + PhotonNetwork.room.playerCount.ToString()); myRole.transform.parent = myPlayer.transform; myPhotonView = myPlayer.GetComponent <PhotonView>(); myPhotonView.observed = myRole.GetComponent <NetworkController>(); } playersInfo.alive[ID] = true; //AddTag(myPhotonView); if (myPhotonView.isMine) { TP_Animator playerAnimator = myRole.GetComponent <TP_Animator>(); TP_Motor playerMotor = myRole.GetComponent <TP_Motor>(); TP_Controller playerController = myRole.GetComponent <TP_Controller>(); TP_Info playerInfo = myRole.GetComponent <TP_Info>(); playerAnimator.enabled = true; playerMotor.enabled = true; playerController.enabled = true; playerInfo.enabled = true; } }
void RangeSpurtAttack(RangeColliderAttack RCA, int force) { List <Transform> skillAttackList = RCA.attackList; IgnoreCollision(false); tempList.Clear(); foreach (Transform enemy in skillAttackList) { if (enemy != null) { tempList.Add(enemy); } } foreach (Transform enemy in tempList) { Debug.Log("enemy: " + enemy.name); PhotonView enemyPV = enemy.GetComponent <PhotonView>(); if (enemyPV != null) { int enemyID = enemyPV.viewID; TP_Info enemyInfo = enemy.GetComponent <TP_Info>(); RangeAttack(enemyInfo, enemyID, force, TP_Animator.HitWays.KnockDown); } } }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (InRoom_Menu.SP.L_LSManager.LightSource > 0 && InRoom_Menu.SP.D_LSManager.LightSource > 0) { OpenESCPage(); } } if (myPlayer == null && InRoom_Menu.SP.localPlayer.transform != null) { myPlayer = InRoom_Menu.SP.localPlayer.transform; playerInfo = myPlayer.GetComponent <TP_Info>(); } CheckCursor(); if (Game_Manager.SP.MyGameState == GameState.OverView) { return; } if (Input.GetKeyDown(KeyCode.F12)) { bool active = VisibleUI[0].activeSelf; foreach (GameObject ui in VisibleUI) { ui.SetActive(!active); } } UpdateState(); UpdateLocalState(); if (playerInfo != null) { UpdateSkillCD(); UpdateLightSource(); //debug LabelBase[15].text = playerInfo.playerAnimator.State.ToString(); } if (Input.GetKeyDown(KeyCode.Tab)) { if (!gameUIPage[(int)GameUIPage.State].activeSelf) { gameUIPage[(int)GameUIPage.State].SetActive(true); } } else if (Input.GetKeyUp(KeyCode.Tab) || Input.GetKeyDown(KeyCode.F12)) { if (gameUIPage[(int)GameUIPage.State].activeSelf) { gameUIPage[(int)GameUIPage.State].SetActive(false); } } UpdateTeammateInfo(); }
void Awake() { myTransform = transform; playerController = GetComponent <TP_Controller>(); playerAnimator = GetComponent <TP_Animator>(); playerInfo = GetComponent <TP_Info>(); islocked = false; SnapToLand = false; }
void Awake() { myTransform = transform; parentTrans = transform.parent.parent; AiForwardTrans = transform.parent; playerInfo = parentTrans.GetComponent <TP_Info>(); rotateParentTrans = transform.parent; _triggerExit = true; SanpToCamera(); }
void Awake() { parentTrans = transform.parent; CC = parentTrans.GetComponent <CharacterController>(); playerInfo = parentTrans.GetComponent <TP_Info>(); playerMotor = parentTrans.GetComponent <TP_Motor>(); roomMenu = GameObject.FindGameObjectWithTag("RoomMenu").GetComponent <InRoom_Menu>(); myPhotonView = transform.parent.GetComponent <PhotonView>(); _lockAttackCheck = false; attackDistance = 100; }
public void UpdateRoleEachSkillValue(TP_Info info, int role, int team) { int curValue = 0; for (int cnt = 0; cnt < 4; cnt++) { curValue = (int)info.GetMagicSkill(cnt).CurValue; roomEachSkillUIpage[cnt + ((role) + (team - 1) * 3) * 5].transform.Find("PowerTag/Value").GetComponent <UILabel>().text = curValue.ToString(); } curValue = (int)info.GetSuperSkill().CurValue; roomEachSkillUIpage[4 + ((role) + (team - 1) * 3) * 5].transform.Find("PowerTag/Value").GetComponent <UILabel>().text = curValue.ToString(); }
void RangeAttack(TP_Info enemyInfo, int enemyID, int force, TP_Animator.HitWays hitWay) { if (IsAIButNotMasterClients()) { return; } if ((int)enemyInfo.GetVital((int)VitalName.Health).CurValue > 0) { if (myPhotonView.isMine) { roomMenu.Hit(myPhotonView.viewID, enemyID, force, hitWay, HitSound.None); } } }
void Awake() { Instance = this; CC = gameObject.GetComponent <CharacterController>(); playerInfo = GetComponent <TP_Info>(); playerController = GetComponent <TP_Controller>(); playerAnimator = GetComponent <TP_Animator>(); myTransform = transform; myPos = myTransform.position; isAlignCamera = true; //JumpSpeed = 400f; Gravity = 500f; TerminalVelocity = 1000f; }
void OnTriggerExit(Collider col) { Transform colTrans = col.transform; string colTag = col.tag; if (myTag == colTag) { if (teamList.Contains(colTrans)) { TP_Info playerInfo = colTrans.GetComponent <TP_Info>(); playerInfo.CanShopping = false; teamList.Remove(colTrans); } } }
void Awake() { IsRunning = true; CharacterController = GetComponent("CharacterController") as CharacterController; playerAnimator = GetComponent <TP_Animator>(); playerMotor = GetComponent <TP_Motor>(); playerInfo = GetComponent <TP_Info>(); roomMenu = GameObject.FindGameObjectWithTag("RoomMenu").GetComponent <InRoom_Menu>(); myPhotonView = GetComponent <PhotonView>(); Instance = this; UselightSourceTimer = 0; buffSkillType = new TP_Animator.BuffSkillType[2]; }
public void UpdateRoleInfo(TP_Info info) { int curValue = 0; float maxValue = 0; for (int cnt = 0; cnt < roomUIInfo.Count; cnt++) { curValue = info.GetAbility(cnt).CurValue; roomUIInfoValue[cnt].text = curValue.ToString(); if (cnt == 0) { maxValue = 200; } else if (cnt == 1) { maxValue = 20; curValue -= 75; } else if (cnt == 2) { maxValue = 15; } else if (cnt == 3) { maxValue = 30; curValue -= 100; } else if (cnt == 4) { maxValue = 100; } else if (cnt == 5) { maxValue = 100; curValue -= 100; } else if (cnt == 6) { maxValue = 100; } roomUIInfo[cnt].value = (curValue / maxValue); } }
void UpdateTeammateInfo() { foreach (GameObject info in TeammateInfoList) { if (info != null) { string IDstr = info.name; int id = Convert.ToInt32(IDstr); TP_Info plaInfo = InRoom_Menu.SP.GetPlayerFromID(id).transform.GetComponent <TP_Info>(); Vital plaHealth = plaInfo.GetVital((int)VitalName.Health); int maxHealth = plaHealth.MaxValue; float curHealth = plaHealth.CurValue; info.GetComponentInChildren <UISlider>().value = curHealth / maxHealth; info.transform.FindChild("MaxHealth").GetComponent <UILabel>().text = maxHealth.ToString(); info.transform.FindChild("CurHealth").GetComponent <UILabel>().text = ((int)curHealth).ToString(); } } }
void OnTriggerEnter(Collider col) { Transform colTrans = col.transform; string colTag = col.tag; if (colTrans != myTransform) { if (myTag == colTag) { if (!teamList.Contains(colTrans)) { teamList.Add(colTrans); TP_Info playerInfo = colTrans.GetComponent <TP_Info>(); playerInfo.CanShopping = true; } } } }
void CheckIfAIAndSetAtWhere(Transform colTrans, int where, bool atOrLeave) { if (where == 1) //Home { TP_Info playerInfo = colTrans.GetComponent <TP_Info>(); if (playerInfo.isAI) { AIScript aiScript = colTrans.GetComponent <AIScript>(); aiScript._atHome = atOrLeave; } } else if (where == 2) //enemy Home { TP_Info playerInfo = colTrans.GetComponent <TP_Info>(); if (playerInfo.isAI) { AIScript aiScript = colTrans.GetComponent <AIScript>(); aiScript._atEnemyHome = atOrLeave; } } }
void OnTriggerEnter(Collider enemy) { string enemyTag = enemy.tag; if (enemy.transform != parentTrans && enemyTag != "team1Light" && enemyTag != "team2Light") { { if (enemyTag == _enemyTeam || enemyTag == "monster") { if (!isExploded) { CreateExplosion(); } Debug.Log(enemy.name); PhotonView enemyPV = enemy.GetComponent <PhotonView>(); if (enemyPV != null) { //hit int enemyID = enemyPV.viewID; TP_Info enemyInfo = enemy.GetComponent <TP_Info>(); if ((int)enemyInfo.GetVital((int)VitalName.Health).CurValue > 0) { if (playerView.isMine) { InRoom_Menu.SP.Hit(playerView.viewID, enemyID, _force, TP_Animator.HitWays.BeHit, HitSound.None); } //roomMenu.Hit(enemyPlayer,force); } } } else { if (!isExploded) { CreateExplosion(); } } } } }
public void RangeSkillInput(TP_Animator.Skilltype skillType, RangeColliderAttack RCA, int force, TP_Animator.HitWays hitWay) { if (skillType == TP_Animator.Skilltype.Attack || skillType == TP_Animator.Skilltype.Darkman_Freeze || skillType == TP_Animator.Skilltype.Mars_Stun || skillType == TP_Animator.Skilltype.Persia_Curse) { List <Transform> skillAttackList = RCA.attackList; tempList.Clear(); foreach (Transform enemy in skillAttackList) { if (enemy != null) { tempList.Add(enemy); } } foreach (Transform enemy in tempList) { Debug.Log("enemy: " + enemy.name); PhotonView enemyPV = enemy.GetComponent <PhotonView>(); if (enemyPV != null) { int enemyID = enemyPV.viewID; TP_Info enemyInfo = enemy.GetComponent <TP_Info>(); switch (skillType) { case TP_Animator.Skilltype.Attack: RangeAttack(enemyInfo, enemyID, force, hitWay); break; case TP_Animator.Skilltype.Darkman_Freeze: RangeFreeze(enemyID, force); break; case TP_Animator.Skilltype.Mars_Stun: RangeDizzyFire(enemyID, force); break; case TP_Animator.Skilltype.Persia_Curse: RangePersiaDecreaseDefense(enemyID, force); break; /*case TP_Animator.Skilltype.DecreseDefense: * break;*/ } } } } else if (skillType == TP_Animator.Skilltype.Darkman_Spurt) { if (IsAIButNotMasterClients()) { return; } StartCoroutine(SpurtMove(10, RCA, force, 0.4f)); } else if (skillType == TP_Animator.Skilltype.Steropi_RollingStrike) { if (IsAIButNotMasterClients()) { return; } StartCoroutine(SpurtMove(15, RCA, force, 0.4f)); } else if (skillType == TP_Animator.Skilltype.Mars_Assault) { if (IsAIButNotMasterClients()) { return; } StartCoroutine(SpurtMove(10, RCA, force, 0.4f)); } else if (skillType == TP_Animator.Skilltype.Darkman_AddDefense || skillType == TP_Animator.Skilltype.Hyperion_AddDefense) { RoleAddDefense(force, playerInfo.Role); } else if (skillType == TP_Animator.Skilltype.Hyperion_Unbeatable) { HyperionUnbeatable(force); } else if (skillType == TP_Animator.Skilltype.Mars_AddAttack || skillType == TP_Animator.Skilltype.Steropi_AddAttack) { RoleAddAttack(force, playerInfo.Role); } else if (skillType == TP_Animator.Skilltype.AddHealth || skillType == TP_Animator.Skilltype.Theia_AddDefense) { List <Transform> skillHelpList = RCA.TeammateList; tempList.Clear(); foreach (Transform teammate in skillHelpList) { if (teammate != null) { tempList.Add(teammate); } } foreach (Transform teammate in tempList) { Debug.Log("teammate: " + teammate.name); int teammatePlayerID = teammate.GetComponent <PhotonView>().viewID; TP_Info teammateInfo = teammate.GetComponent <TP_Info>(); switch (skillType) { case TP_Animator.Skilltype.AddHealth: RangeAddHealth(teammatePlayerID, force); break; case TP_Animator.Skilltype.Theia_AddDefense: RangeTheiaAddDefense(teammatePlayerID, force); break; } } } if (skillType != TP_Animator.Skilltype.Darkman_Spurt && skillType != TP_Animator.Skilltype.Steropi_RollingStrike && skillType != TP_Animator.Skilltype.Mars_Assault) { RCA.ClearList(); RCA.gameObject.SetActive(false); } else { StartCoroutine(WaitClearList(RCA)); } }
// Use this for initialization void Start() { myTransform = transform; rayDistance = 0.6f; backRayObj = false; rightRayObj = false; leftRayObj = false; wildHarnesses = GameObject.Find("GameScript").GetComponent <Game_Manager>().WildHarnesses; playerController = GetComponent <TP_Controller>(); playerAnimator = GetComponent <TP_Animator>(); playerInfo = GetComponent <TP_Info>(); playerHealth = playerInfo.GetVital((int)VitalName.Health); PhotonView playerView = GetComponent <PhotonView>(); if (playerView.isMine) { _owner = true; } else { _owner = false; } aiRig.AI.WorkingMemory.SetItem("owner", _owner); aiRig.AI.WorkingMemory.SetItem("changePosTimer", 0); aiRig.AI.WorkingMemory.SetItem("DyingHealth", (int)(playerHealth.MaxValue * 0.1f)); aiRig.AI.WorkingMemory.SetItem("wild", _wild); aiRig.AI.WorkingMemory.SetItem("T", 0); aiRig.AI.WorkingMemory.SetItem("isChangingPos", false); _task = 0; _level = 1; _speed = playerInfo.GetAbility((int)(AbilityName.MoveSpeed)).CurValue; _canShopping = true; _needShopping = true; _atHome = false; _atEnemyHome = false; _hasEnemy = false; _canChangeState = true; _canUseSkill = true; aiRig.AI.WorkingMemory.SetItem("canUseSkill", _canUseSkill); aiRig.AI.WorkingMemory.SetItem("hasEnemy", _hasEnemy); aiRig.AI.WorkingMemory.SetItem("canShopping", _canShopping); aiRig.AI.WorkingMemory.SetItem("needShopping", _needShopping); aiRig.AI.WorkingMemory.SetItem("forwardSpeed", _speed); aiRig.AI.WorkingMemory.SetItem("canUseLS", true); aiRig.AI.WorkingMemory.SetItem("SkillTimer", 0); aiRig.AI.WorkingMemory.SetItem("LSTimer", 0); aiRig.AI.WorkingMemory.SetItem("atHome", _atHome); aiRig.AI.WorkingMemory.SetItem("atEnemy", _atEnemyHome); aiRig.AI.WorkingMemory.SetItem("ready", false); aiRig.AI.WorkingMemory.SetItem("TaskNum", _task); aiRig.AI.WorkingMemory.SetItem("attackTar", AttackTarget); _state = playerAnimator.State.ToString(); _attack = ""; aiRig.AI.WorkingMemory.SetItem("state", _state); aiRig.AI.WorkingMemory.SetItem("attackWay", _attack); _wPNdiecrtion = Vector3.zero; aiRig.AI.WorkingMemory.SetItem("WPNdiecrtion", _wPNdiecrtion); //_state = TP_Animator.CharacterState.None; isResetWild = false; aiRig.AI.WorkingMemory.SetItem("reset", isResetWild); skillState = new bool[5]; }
void MeleeAttackCheck(float attDistance, float attAngle, int force, TP_Animator.HitWays hitWay) { if (IsAIButNotMasterClients()) { return; } for (int cnt = 0; cnt < attackList.Count; cnt++) { Transform enemy = attackList[cnt]; if (enemy == null) { attackList.Remove(enemy); } else { if (enemy != parentTrans) { Vector3 targetDir = enemy.transform.position - parentTrans.position; Vector3 dir = targetDir.normalized; float angle = Vector3.Dot(dir, parentTrans.forward); // Debug.Log("Name:" + enemy.name + " Dis:" + Vector3.Magnitude(targetDir) + "A:" + angle); if (Vector3.Magnitude(targetDir) <= attDistance && angle > attAngle) { if (!tempList.Contains(enemy)) { tempList.Add(enemy); } } } } } if (tempList.Count > 0) { HitSound sound = HitSound.None; if (playerInfo.Role == TP_Info.CharacterRole.Mars) { sound = HitSound.Sword1; } else if (playerInfo.Role == TP_Info.CharacterRole.DarkMan) { sound = HitSound.Sword2; } else if (playerInfo.Role == TP_Info.CharacterRole.Steropi) { sound = HitSound.Fist; } else if (playerInfo.Role == TP_Info.CharacterRole.Hyperion) { sound = HitSound.Slap; } for (int cnt = 0; cnt < tempList.Count; cnt++) { foreach (Transform enemy in tempList) { //Transform enemy = attackList[cnt]; if (enemy == null) { tempList.Remove(enemy); } else { PhotonView enemyPV = enemy.GetComponent <PhotonView>(); if (enemyPV != null) { int enemyID = enemyPV.viewID; TP_Info enemyInfo = enemy.GetComponent <TP_Info>(); if ((int)enemyInfo.GetVital((int)VitalName.Health).CurValue > 0) { Debug.Log(enemyInfo.gameObject.name + " got hit!"); if (myPhotonView.isMine) { roomMenu.Hit(myPhotonView.viewID, enemyID, force, hitWay, sound); } } } } } } } tempList.Clear(); }