public void IntializeEnemyInfo3V3(Role_Camp camp) { enemyInfo = new DeathInfo[1]; for (int i = 0; i < 3; i++) { Role_Main temp1 = Scence3v3_Intialize.Instance.role_Players [i].GetComponent <Role_Main> (); Role_Main temp2 = Scence3v3_Intialize.Instance.role_AIs [i].GetComponent <Role_Main>(); if (camp == Role_Camp.Blue) { if (temp1.roleCamp == Role_Camp.Red) { enemyInfo [0].roleMain = temp1; } if (temp2.roleCamp == Role_Camp.Red) { enemyInfo [0].roleMain = temp2; } } if (camp == Role_Camp.Red) { if (temp1.roleCamp == Role_Camp.Blue) { enemyInfo [0].roleMain = temp1; } if (temp2.roleCamp == Role_Camp.Blue) { enemyInfo [0].roleMain = temp2; } } } }
void Awake() { kindOfPlayers = new Enum_Role[3]; kindOfAIs = new Enum_Role[3]; role_Players = new GameObject[3]; role_AIs = new GameObject[3]; uimanager = GameObject.Find("UI").GetComponent <UIManager> (); uimanager.mapSelect = MapSelect.threeVSthree; Debug.Log(uimanager.mapSelect); _instance = this; // kindOfAI = Enum_Role.XiaoYaoZi; //此行测试用 外部传入数据 // kindOfPlayer = Enum_Role.Ahri; //此行测试用 外部传入数据 IntializeRoleType(Application.dataPath + "/InitializeInfo/HerosChooosed.text"); //选择玩家的英雄角色 playerCamp = ChoiceCamp(); //选择红蓝方,包括出生位置 ChoiceBirthPos(playerCamp); int skinNumPlayer = 0; //当前的皮肤,应当从施传来 int skinNumEnum = 0; //当前的皮肤,应当从施传来 for (int i = 0; i < 3; i++) { GameObject role_PlayerPrefab = ChoicePrefab(kindOfPlayers[i], skinNumPlayer); role_Players[i] = Instantiate(role_PlayerPrefab, pos_PlayerInti.position, Quaternion.identity) as GameObject; //生成玩家的英雄 GameObject role_AiPrefab = ChoicePrefab(kindOfAIs[i], skinNumEnum); role_AIs[i] = Instantiate(role_AiPrefab, pos_AiInti.position, Quaternion.identity) as GameObject; //生成电脑英雄; } IntilalizeCamp(playerCamp); //初始化两边的整容; }
public void IntializeEnemyInfo1V1(Role_Camp camp) { Debug.Log("初始化IntializeEnemyInfo1V1"); enemyInfo = new DeathInfo[1]; Role_Main temp1 = Scence1v1_Intialize.Instance.role_Player.GetComponent <Role_Main> (); Role_Main temp2 = Scence1v1_Intialize.Instance.role_AI.GetComponent <Role_Main> (); if (camp == Role_Camp.Blue) { if (temp1.roleCamp == Role_Camp.Red) { enemyInfo [0].roleMain = temp1; } if (temp2.roleCamp == Role_Camp.Red) { enemyInfo [0].roleMain = temp2; } } if (camp == Role_Camp.Red) { if (temp1.roleCamp == Role_Camp.Blue) { enemyInfo [0].roleMain = temp1; } if (temp2.roleCamp == Role_Camp.Blue) { enemyInfo [0].roleMain = temp2; } } }
public void IntilalizeCamp(Role_Camp camp) { switch (camp) { case Role_Camp.Red: for (int i = 0; i < 3; i++) { role_Players[i].GetComponent <Role_Main> ().roleCamp = Role_Camp.Red; role_Players[i].layer = LayerMask.NameToLayer("Red"); //初始化role的层 role_AIs[i].GetComponent <Role_Main> ().roleCamp = Role_Camp.Blue; role_AIs[i].layer = LayerMask.NameToLayer("Blue"); } break; case Role_Camp.Blue: for (int i = 0; i < 3; i++) { role_Players[i].GetComponent <Role_Main> ().roleCamp = Role_Camp.Blue; role_Players[i].layer = LayerMask.NameToLayer("Blue"); role_AIs[i].GetComponent <Role_Main> ().roleCamp = Role_Camp.Red; role_AIs[i].layer = LayerMask.NameToLayer("Red"); } break; } }
public void BaseStart() { uiManager = GameObject.Find("UI").GetComponent <UIManager> (); if (type_Allrole != Type_Allrole.buffer) //是buffer的话就不设置 { if (uiManager.mapSelect == MapSelect.threeVSthree) { playerCamp = Scence3v3_Intialize.Instance.playerCamp; } if (uiManager.mapSelect == MapSelect.oneVSone) { playerCamp = Scence1v1_Intialize.Instance.playerCamp; } if (roleCamp == playerCamp) { GetComponent <FOWRevealer> ().enabled = true; GetComponent <FOWRenderers> ().enabled = false; } else { GetComponent <FOWRevealer> ().enabled = false; GetComponent <FOWRenderers> ().enabled = true; } } }
string GetOtherCamp(Role_Camp cam) { if (cam == Role_Camp.Blue) { return("Red"); } else { return("Blue"); } }
// Update is called once per frame void Update() { if (IsGameOver) { redWin = GameCount.Instance.redWin; blueWin = GameCount.Instance.blueWin; role_Red = GameCount.Instance.roles_Red; role_Blue = GameCount.Instance.roles_Blue; camp = GameCount.Instance.camp; mapSelect = UIManager.instance.mapSelect; } }
public void JudgeGame(Role_Camp winner, Role_Camp player) { if (winner == player) { obj_win.SetActive(true); obj_button.SetActive(true); } else { obj_lose.SetActive(true); obj_button.SetActive(true); } }
// private AnimatorController ac = RuntimeAnimatorController as AnimatorController; 控制单个动画时使用 // private StateMachine sm=ac.GetLayer(0).stateMachine; void Start(){ transform.gameObject.AddComponent<Solider_Buff> (); camp = GetComponent <RoleInfo> ().roleCamp; paths = ChoicePaths (camp); layerEnemy = GetComponent <RoleInfo> ().EnemyLayer; soliderAgent = transform.GetComponent <NavMeshAgent> (); ani = GetComponent<Animator> (); if (paths != null && paths .Length >0) { target = paths[index]; } // bullet =Resources .Load <GameObject>("Prefeb_Role/bullet_S"); }
}//AI_move public Transform[] ChoicePaths(Role_Camp camp1){ Transform path=GameObject .Find ("PathSolider").transform ; Transform[] path2 = new Transform[path.childCount]; if (camp1 == Role_Camp.Red) { for (int i = 0; i < path.childCount ; i++) { path2 [i] = path.GetChild (i); } } else if (camp1 ==Role_Camp.Blue) { for (int i = 0; i < path.childCount ; i++) { path2 [i] = path.GetChild(path.childCount-i-1); } } return path2; }
public void ChoiceBirthPos(Role_Camp camp) //红色方在point_01;蓝色方在point_05 { switch (camp) { case Role_Camp.Red: pos_PlayerInti = GameObject.Find("RebirthPos/RebirthPos_Red").transform; pos_AiInti = GameObject.Find("RebirthPos/RebirthPos_Blue").transform; break; case Role_Camp.Blue: pos_PlayerInti = GameObject.Find("RebirthPos/RebirthPos_Blue").transform; pos_AiInti = GameObject.Find("RebirthPos/RebirthPos_Red").transform; break; } }
public void BaseStart() { uiManager = GameObject.Find("UI").GetComponent <UIManager> (); if (type_Allrole != Type_Allrole.buffer) //是buffer的话就不设置 { if (uiManager.mapSelect == MapSelect.threeVSthree) { playerCamp = Scence3v3_Intialize.Instance.playerCamp; } if (uiManager.mapSelect == MapSelect.oneVSone) { playerCamp = Scence1v1_Intialize.Instance.playerCamp; } } }
public void IntilalizeCamp(Role_Camp camp) { switch (camp) { case Role_Camp.Red: role_Player.GetComponent <Role_Main> ().roleCamp = Role_Camp.Red; role_Player.layer = LayerMask.NameToLayer("Red"); //初始化role的层 role_AI.GetComponent <Role_Main> ().roleCamp = Role_Camp.Blue; role_AI.layer = LayerMask.NameToLayer("Blue"); break; case Role_Camp.Blue: role_Player.GetComponent <Role_Main> ().roleCamp = Role_Camp.Blue; role_Player.layer = LayerMask.NameToLayer("Blue"); role_AI.GetComponent <Role_Main> ().roleCamp = Role_Camp.Red; role_AI.layer = LayerMask.NameToLayer("Red"); break; } }
void Awake() { _instance = this; uimanager = GameObject.Find("UI").GetComponent <UIManager> (); uimanager.mapSelect = MapSelect.oneVSone; //初始化是1V1 or 3V3 IntializeRoleType(Application.dataPath + "/InitializeInfo/HerosChooosed.text"); //选择玩家的英雄角色 playerCamp = ChoiceCamp(); //选择红蓝方,包括出生位置 ChoiceBirthPos(playerCamp); int skinNumPlayer = 0; //当前的皮肤,应当从施传来 GameObject role_PlayerPrefab = ChoicePrefab(kindOfPlayer, skinNumPlayer); role_Player = Instantiate(role_PlayerPrefab, pos_PlayerInti.position, Quaternion.identity) as GameObject; //生成玩家的英雄 int skinNumEnum = 0; //当前的皮肤,应当从施传来 GameObject role_AiPrefab = ChoicePrefab(kindOfAI, skinNumEnum); role_AI = Instantiate(role_AiPrefab, pos_AiInti.position, Quaternion.identity) as GameObject; //生成电脑英雄; IntilalizeCamp(playerCamp); //初始化两边的整容; }
// Use this for initialization void Start() { _instance = this; uiManager = GameObject.Find("UI").GetComponent <UIManager> (); //1V1 or 3V3 if (uiManager.mapSelect == MapSelect.oneVSone) { camp = Scence1v1_Intialize.Instance.playerCamp; roleMains_Red = new Role_Main[1]; roleMains_Blue = new Role_Main[1]; roles_Red = new Record_Role[1]; roles_Blue = new Record_Role[1]; if (camp == Role_Camp.Red) { roleMains_Red [0] = Scence1v1_Intialize.Instance.role_Player.GetComponent <Role_Main> (); roleMains_Blue [0] = Scence1v1_Intialize.Instance.role_AI.GetComponent <Role_Main> (); } if (camp == Role_Camp.Blue) { roleMains_Red [0] = Scence1v1_Intialize.Instance.role_AI.GetComponent <Role_Main> (); roleMains_Blue [0] = Scence1v1_Intialize.Instance.role_Player.GetComponent <Role_Main> (); } } if (uiManager.mapSelect == MapSelect.threeVSthree) { camp = Scence3v3_Intialize.Instance.playerCamp; roleMains_Red = new Role_Main[3]; roleMains_Blue = new Role_Main[3]; roles_Red = new Record_Role[3]; roles_Blue = new Record_Role[3]; if (camp == Role_Camp.Red) { for (int i = 0; i < Scence3v3_Intialize.Instance.role_Players.Length; i++) { roleMains_Red [i] = Scence3v3_Intialize.Instance.role_Players [i].GetComponent <Role_Main> (); roleMains_Blue [i] = Scence3v3_Intialize.Instance.role_AIs [i].GetComponent <Role_Main> (); } } if (camp == Role_Camp.Blue) { for (int i = 0; i < Scence3v3_Intialize.Instance.role_AIs.Length; i++) { roleMains_Red [i] = Scence3v3_Intialize.Instance.role_AIs [i].GetComponent <Role_Main> (); roleMains_Blue [i] = Scence3v3_Intialize.Instance.role_Players [i].GetComponent <Role_Main> (); } } } towerBlue = GameObject.Find("shuiJingBlue").GetComponent <TowerBaseInfo>(); towerRed = GameObject.Find("shuiJingRed").GetComponent <TowerBaseInfo> (); CanOver = false; cam = Camera.main.transform; redPos = GameObject.Find("shuiJingRed").transform; bluePos = GameObject.Find("shuiJingBlue").transform; obj_win = GameObject.Find("UI/gameOverShow/win"); obj_lose = GameObject.Find("UI/gameOverShow/lose"); obj_button = GameObject.Find("UI/gameOverShow/gameover"); obj_win.SetActive(false); obj_lose.SetActive(false); obj_button.SetActive(false); }