private GuardScript SpawnGuard(GameObject spawnPoint) { GameObject newGuard = Instantiate(guardTemplate); GuardScript newGuardScript = newGuard.GetComponent <GuardScript>(); newGuardScript.SetManager(this); newGuardScript.SetPosition(spawnPoint.transform.position); return(newGuardScript); }
// Use this for initialization void Start() { //ディレクタースクリプト取得 ASScriptEne = Pcont.fightEnemy.GetComponent <ArtsStateScript>(); CEvent = this.GetComponent <ColliderEvent>(); CEventEne = Pcont.fightEnemy.GetComponent <ColliderEvent>(); HPDir = this.GetComponent <HPDirectorScript>(); DEGScript = this.GetComponent <DebugGetEnemyScript>(); SEScript = this.GetComponent <SetEffectScript>(); GScript = this.GetComponent <GuardScript>(); //コライダーのスクリプトを取得 for (int i = 0; i < CEvent.HClid.Count; i++) { col.Add(CEvent.HClid[i]); react.Add(col[i].GetComponent <ColliderReact>()); } AI = gameObject.GetComponent <EnemyAI>(); }
// Use this for initialization void Start() { for (int i = 0; i < 2; i++) { //キャラクター設定 switch (InScript.Fighter(i).tag) { case "P1": player1 = InScript.Fighter(0); SetPlayerState(player1.name, P1Image, P1Name, player1); player1Controller = player1.GetComponent <PlayerController>(); player1Controller.CanControll = false; break; case "P2": player2 = InScript.Fighter(1); SetPlayerState(player2.name, P2Image, P2Name, player2); player2Controller = player2.GetComponent <PlayerController>(); player2Controller.CanControll = false; break; } } HP1 = player1.GetComponent <HPDirectorScript>(); HP2 = player2.GetComponent <HPDirectorScript>(); Guard1 = player1.GetComponent <GuardScript>(); Guard2 = player2.GetComponent <GuardScript>(); initPos1 = player1.transform.position; initPos2 = player2.transform.position; player1.transform.position = initPos1; player2.transform.position = initPos2; //comboScript = GetComponent<ComboScript>(); gameScript = GetComponent <GetGameScript>(); }
// Use this for initialization void Start() { //スクリプト取得 GScript = this.GetComponent <GuardScript>(); playerController = this.GetComponent <PlayerController>(); }
// Use this for initialization void Start() { // get the canvas element GameObject canvas = GameObject.FindGameObjectWithTag("Canvas"); // Lookups from string to enums! string_enums = new Dictionary<string, RelationshipType>(); string_enums.Add("FRIEND", RelationshipType.FRIEND); string_enums.Add("ENEMY", RelationshipType.ENEMY); string_enums.Add("RIVAL", RelationshipType.RIVAL); string_enums.Add("MEMBER", RelationshipType.MEMBER); // instantiate the cast members! gs = castLead.GetComponent<GuardScript>(); cast = new Dictionary<string, GameObject>(); for (int i = 0; i < castNames.Length; i++) { GameObject castMember = Instantiate(castMemberPrefab); castMember.name = castNames[i]; // group connection if (i == 4) { castMember.GetComponent<Demo3Character>().EntityType = EntityType.GROUP; graph.AddDirectConnection(new Connection(castLead, castMember, member)); } // direct connections if (i < 4) { graph.AddDirectConnection(new Connection(castLead, castMember, friend)); } // indirect connection if (i > 5) { graph.AddConnection(castLead.GetComponent<Demo3Character>(), new Connection(cast[castNames[3]], cast[castNames[5]], rival)); } if(i == 7) { graph.AddDirectConnection(new Connection(castLead, castMember, rival)); } // connection known through group i.e. group knows so I know if (i == 9) { graph.AddDirectConnection(new Connection(cast[castNames[4]], castMember, enemy)); } // otherwise, the entities are unknown int ypos = 250 - (i * 20); GameObject castCheckbox = Instantiate(castMemberCheckPrefab, new Vector3(90, ypos, 0), Quaternion.identity) as GameObject; castCheckbox.transform.SetParent(canvas.transform); castCheckbox.GetComponentInChildren<Text>().text = castNames[i]; castCheckbox.name = castNames[i]; castCheckbox.GetComponent<Toggle>().group = GameObject.FindGameObjectWithTag("CastToggleGroup").GetComponent<ToggleGroup>(); if (i == 0) { castCheckbox.GetComponent<Toggle>().isOn = true; } // track the cast members cast.Add(castNames[i], castMember); } activeRelationshipType = RelationshipType.FRIEND; activeCastMember = cast[castNames[0]]; }
// Use this for initialization void Start() { //instantiate weather effects and music deathTollText = GameObject.Find("DeathTollText").GetComponent <Text> (); deathTollText.text = "0 have died"; winterWeather = GameObject.Find("WinterWeather"); winterWeather.SetActive(false); springWeather = GameObject.Find("SpringWeather"); springWeather.SetActive(false); summerWeather = GameObject.Find("SummerWeather"); summerWeather.SetActive(false); fallWeather = GameObject.Find("FallWeather"); fallWeather.SetActive(false); fallMusicBoxObject = GameObject.Find("FallMusicBox"); springMusicBoxObject = GameObject.Find("SpringMusicBox"); summerMusicBoxObject = GameObject.Find("SummerMusicBox"); winterMusicBoxObject = GameObject.Find("WinterMusicBox"); nightMusicBoxObject = GameObject.Find("NightMusicBox"); springMusicBoxScript = springMusicBoxObject.GetComponent <SpringMusicBoxScript> (); summerMusicBoxScript = summerMusicBoxObject.GetComponent <SpringMusicBoxScript> (); fallMusicBoxScript = fallMusicBoxObject.GetComponent <SpringMusicBoxScript> (); winterMusicBoxScript = winterMusicBoxObject.GetComponent <SpringMusicBoxScript> (); nightMusicBoxScript = nightMusicBoxObject.GetComponent <SpringMusicBoxScript> (); //find advisors guardScript = GameObject.Find("Guard").GetComponent <GuardScript>(); witchScript = GameObject.Find("Witch").GetComponent <WitchScript>(); //find notification text notificationText = GameObject.Find("NotificationText").GetComponent <Text> (); notificationText.text = ""; //Load in txt files to word lists loadWordLists(); //find the screen fader screenFader = GameObject.Find("ScreenFader"); screenFaderScript = screenFader.gameObject.GetComponent <ScreenFaderScript> (); //write season text seasonText = GameObject.Find("SeasonText").GetComponent <Text> (); seasonText.text = "spring"; //set us to night isDay = false; //create list fo opponents opponentList = new List <GameObject>(); //find the day counter in UI dayNumberText = GameObject.Find("DayNumberText").GetComponent <Text>(); //create the world with opponents, player, and decorations (cursor too) CreateWorld(); //establish reference to well well = GameObject.FindGameObjectWithTag("Well"); wellScript = well.GetComponent <WellScript> (); //establish reference to player village myPlayerVillage = GameObject.FindGameObjectWithTag("PlayerVillage"); myPlayerVillageScript = myPlayerVillage.gameObject.GetComponent <PlayerVillageScript> (); //Camera background camera.clearFlags = CameraClearFlags.SolidColor; destroyWordLists(); nightMusicBoxScript.FadeInMusic(); //color trees for (int i = 0; i < trees.Length; i++) { trees [i].GetComponent <Renderer>().material.color = springSummerTreeColor; } //set day number dayNumberText.text = "night " + dayNumber; origOpponents = opponents; }
public override void Awake() { base.Awake(); gs = GetComponent<GuardScript>(); }
public void KillFromTaze(GuardScript GS) { if(!beingTazed) return; string path = "Prefabs/" + Bloodpool.name; if (Network.connections.Length > 0) { Connector.AddEntityReturn(Bloodpool.name, transform.position - new Vector3(0,0,3), Quaternion.identity, path, "Untagged", true); }else { Instantiate(Resources.Load(path), transform.position - new Vector3(0,0,3), Quaternion.identity); } //this.renderer.enabled = false; //this.collider2D.isTrigger = true; //print("Han er døøøøø'"); GS.DeathCount(); thievesAlive--; Destroy(progress); Destroy(ActionButton); Destroy(gameObject); }
void Start() { guardScript = GetComponentInParent <GuardScript>(); }
private void SetDifficulty() { DifficultySetting difficulty = difficultySettings[currentDifficulty]; switch (SceneManager.GetActiveScene().name) { case "WarScene": FindObjectOfType <WarScene>().CollectableLifeSeconds = difficulty.CollectableLifeSeconds; BombEmitter bombEmitter = FindObjectOfType <BombEmitter>(); bombEmitter.BombIntervalSeconds = difficulty.BombInterval; bombEmitter.BombDrag = difficulty.BombDrag; foreach (BombScript bomb in FindObjectsOfType <BombScript>()) { bomb.GetComponent <Rigidbody2D>().drag = difficulty.BombDrag; } break; case "SeaScene": SeaScene sea = FindObjectOfType <SeaScene>(); sea.StartingWaveStrength = difficulty.StartingWaveSize; sea.EndingWaveStrength = difficulty.EndingWaveSize; LandScene.FindObjectsOfTypeAll <EnemyGun>()[0].ShootDelay = difficulty.ShootDelay; break; case "LandScene": Searchlight light = LandScene.FindObjectsOfTypeAll <Searchlight>()[0]; //Find it even if it is disabled light.SweepSpeed = difficulty.SearchlightSpeed; light.FramesVisibleForLoss = difficulty.SearchlightTime; GuardScript guard = LandScene.FindObjectsOfTypeAll <GuardScript>()[0]; guard.FramesVisibleForLoss = difficulty.GuardTime; guard.WalkSpeed = difficulty.GuardSpeed; LandScene.FindObjectsOfTypeAll <FenceCut>()[0].CutSpeed = difficulty.CutFenceSpeed; break; default: Debug.Log("Can't change difficulty in this scene"); break; } ShowText(); DiffText.color = DifficultyTextColours[currentDifficulty]; switch (currentDifficulty) { case 0: DiffText.text = "E"; break; case 1: DiffText.text = "N"; break; case 2: DiffText.text = "H"; break; case 3: DiffText.text = "EX"; break; default: Debug.LogError("...What just happened?"); break; } }