void Awake() { if (gc == null) { gc = this; } else { // if this one's a duplicate, destroy Destroy(this.gameObject); return; } DontDestroyOnLoad(this); titleText = editorTitleText; dialogueUI = GetComponentInChildren <DialogueUI>(); signUI = GetComponentInChildren <SignUI>(); pc = GetComponentInChildren <PlayerController>(); rm = GetComponent <RespawnManager>(); playerFollower = gc.GetComponentInChildren <PlayerFollower>(); save = gc.GetComponent <Save>(); blackoutUI = GetComponentInChildren <BlackFadeUI>(); pauseUI = gc.transform.Find("PixelCanvas").transform.Find("PauseUI").GetComponent <Animator>(); abilityUIAnimator = gc.transform.Find("PixelCanvas").transform.Find("AbilityGetUI").GetComponent <Animator>(); inventory = gc.GetComponentInChildren <InventoryController>(); parallaxOption = gc.GetComponentInChildren <ParallaxOption>(); }
public void SetCharacter(int character) { if (holder == null) { holder = FindObjectOfType <MainUIHolder> (); } if (current == null) { current = Instantiate(playerModels [character], this.transform) as PlayerModelController; } var p = Instantiate(portal, this.transform); p.ActivateFor5(); current.gameObject.SetActive(false); StartCoroutine(SetActiveAfter4Seconds()); holder.mana.fillRect.GetComponent <Image> ().color = current.color; cc = current.GetComponent <CharacterController> (); PlayerFollower pf = Camera.main.gameObject.GetComponent <PlayerFollower> (); if (pf != null) { pf.toFollow = current.transform; } uic.DisplayHearts(current.GetHealth(), current.GetMaxHealth()); current.transform.position = Vector3.zero; }
void Awake() { if (gc == null) { gc = this; } else { // if this one's a duplicate, destroy Destroy(this.gameObject); return; } DontDestroyOnLoad(this); titleText = editorTitleText; dialogueUI = GetComponentInChildren <DialogueUI>(); signUI = GetComponentInChildren <SignUI>(); pc = GetComponentInChildren <PlayerController>(); rm = GetComponent <RespawnManager>(); playerFollower = gc.GetComponentInChildren <PlayerFollower>(); save = gc.GetComponent <SaveWrapper>().save; blackoutUI = GetComponentInChildren <BlackFadeUI>(); pauseUI = GetComponentInChildren <PauseUI>(); abilityUIAnimator = GameObject.Find("AbilityGetUI").GetComponent <Animator>(); inventory = gc.GetComponentInChildren <InventoryController>(); parallaxOption = gc.GetComponentInChildren <ParallaxOption>(); bossHealthUI = GameObject.Find("BossHealthUI").GetComponent <BarUI>(); bossHealthUI.gameObject.SetActive(false); playerMenu = GameObject.Find("PlayerMenu"); binarySaver = gc.GetComponent <BinarySaver>(); saveWrapper = gc.GetComponent <SaveWrapper>(); audioListener = gc.GetComponentInChildren <AudioListener>(); bossFightIntro = gc.GetComponentInChildren <BossFightIntro>(includeInactive: true); }
public void quitCinematic() { Debug.Log("quitCinematic....."); // GET PlayerController pc = playerGO.GetComponent <PlayerController>(); PlayerFollower playerFollow = cameraGO.GetComponent <PlayerFollower>(); CinematicFollower CF = cameraGO.GetComponent <CinematicFollower>(); // LOGIC if (!!pc) { pc.freezeMovements = false; if (!!playerFollow) { playerFollow.paused = false; } } if (!!CF) { CF.paused = true; } ableToLaunchSequence = true; cinematicIsPlaying = false; cinematicMustBePlayed = false; }
// Use this for initialization void Start() { audio.PlayOneShot(sound); Vector3 explosionPos = transform.position; Collider[] colliders = Physics.OverlapSphere(explosionPos, radius); foreach (Collider hit in colliders) { if (!hit || hit.Equals(this.collider)) { continue; } if (hit.rigidbody && hit.tag != "unavailable" && (hit.tag == "player" || hit.tag == "enemy")) { hit.rigidbody.AddExplosionForce(power, explosionPos, radius, 3.0f); } } if (shakeEffect) { PlayerFollower f = Camera.main.GetComponent <PlayerFollower> (); f.playShakeEffect(); } }
private void AddSegment() { GameObject segment = Instantiate(prefab, tail.position, Quaternion.identity); PlayerFollower comp = segment.GetComponent <PlayerFollower>(); comp.head = tail; tail = segment.transform; }
public void Test() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); pf.buffer = new Vector3(-10, 0, 0); transform.Translate(Input.GetAxis("Vertical") * 0.5f, 0, -Input.GetAxis("Horizontal") * 0.3f); }
// Use this for initialization void Start() { Time.timeScale = 0f; playerFollower = FindObjectOfType <PlayerFollower>(); Debug.Log(playerFollower); state = ControllerState.FADE_IN; last_movement = Vector2.right; nextProjectileFire = Time.time; fadeStartTime = 0f; scoreText.text = " LEVEL " + ScoreManager.Instance.Level + "\n LIVES " + ScoreManager.Instance.Lives; }
public void ChangeDifficulty() { switch (difficultyValue.text) { case "Baby boy": PlayerFollower.SetSeconds(60); break; case "Lad": PlayerFollower.SetSeconds(30); break; case "Life is hard": PlayerFollower.SetSeconds(20); break; case "Death is near": PlayerFollower.SetSeconds(10); break; } }
void Awake() { gc = this; titleText = editorTitleText; DontDestroyOnLoad(this); dialogueUI = GetComponentInChildren <DialogueUI>(); signUI = GetComponentInChildren <SignUI>(); pc = GetComponentInChildren <PlayerController>(); rm = GetComponent <RespawnManager>(); playerFollower = gc.GetComponentInChildren <PlayerFollower>(); save = gc.GetComponent <Save>(); blackoutUI = GetComponentInChildren <BlackFadeUI>(); }
private void MakeObjectsVisible(Camera cam) { PlayerFollower follower = cam.GetComponent <PlayerFollower>(); if (!follower) { return; } foreach (var collider in colliders) { SwitchComponentsActivity <Renderer>(collider, true); } }
public void onCitySky() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(0, 10, 0); transform.Translate(0, flyingSpeed * Time.deltaTime, 0); if (transform.position.y <= 1.5f) { mc.Tire(); changeState("skyToLand"); print("I am changing my state to state : " + state); } }
// 6) when player is in last street and hits the first LEFT turn public void lastLeftTurn() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(10, 0, 0); transform.Translate(flyingSpeed * Time.deltaTime, 0, Input.GetAxis("Horizontal") * 0.3f); if (transform.position.x <= -6.5f) { mc.Tire(); changeState("cityEnd"); print("I am changing my state to state : " + state); } happenedOnce = false; }
// 3) when player is in first street and hits the first turn public void firstRightTurn() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(0, 0, 10); transform.Translate(-Input.GetAxis("Horizontal") * 0.3f, 0, flyingSpeed * Time.deltaTime); if (transform.position.z <= -13) { mc.Tire(); changeState("secondRightTurn"); print("I am changing my state to state : " + state); } happenedOnce = false; }
// 2) when it is landing from sky to the city public void skyToLand() { print("My current state is : " + state); PlayerFollower pf = Camera.main.GetComponent <PlayerFollower>(); Music_Controller mc = Camera.main.GetComponent <Music_Controller>(); pf.buffer = new Vector3(-10, 0, 0); transform.Translate(-flyingSpeed * Time.deltaTime, 0, -Input.GetAxis("Horizontal") * 0.3f); print("Player position : " + transform.position); if (transform.position.x >= 41) { mc.Tire(); changeState("firstRightTurn"); print("I am changing my state to state : " + state); } happenedOnce = false; }
private void CheckAndHide(Camera cam) { PlayerFollower follower = cam.GetComponent <PlayerFollower>(); if (!follower) { return; } Player player = follower.ObservablePlayer; if (player && player.isLocalPlayer) { foreach (var collider in colliders) { if ((player.transform.position - collider.transform.position).sqrMagnitude > visibleDistance * visibleDistance) { SwitchComponentsActivity <Renderer>(collider, false); } } } }
public void launchCinematic() { // GET PlayerController pc = playerGO.GetComponent <PlayerController>(); PlayerFollower playerFollow = cameraGO.GetComponent <PlayerFollower>(); CinematicFollower CF = cameraGO.GetComponent <CinematicFollower>(); // LOGIC if (!!pc) { pc.freezeMovements = true; if (!!playerFollow) { playerFollow.paused = true; } } if (!!CF) { CF.paused = false; } playCinematic(); }
#pragma warning restore 0649 void Awake() { gc = this; titleText = editorTitleText; dialogueUI = GetComponentInChildren <DialogueUI>(); signUI = GetComponentInChildren <SignUI>(); pc = GetComponentInChildren <PlayerController>(); rm = GetComponent <RespawnManager>(); playerFollower = gc.GetComponentInChildren <PlayerFollower>(); blackoutUI = GetComponentInChildren <BlackFadeUI>(); pauseUI = GetComponentInChildren <PauseUI>(); abilityUIAnimator = GameObject.Find("AbilityGetUI").GetComponent <Animator>(); inventory = gc.GetComponentInChildren <InventoryController>(); parallaxOption = gc.GetComponentInChildren <ParallaxOption>(); bossHealthUI = GameObject.Find("BossHealthUI").GetComponent <BarUI>(); bossHealthUI.gameObject.SetActive(false); playerMenu = GameObject.Find("PlayerMenu"); audioListener = gc.GetComponentInChildren <AudioListener>(); bossFightIntro = gc.GetComponentInChildren <BossFightIntro>(includeInactive: true); #if UNITY_EDITOR EditorApplication.playModeStateChanged += OnPlayModeChange; #endif }
// Use this for initialization void Start() { board1 = GameObject.Find("Board1").transform; board2 = GameObject.Find("Board2").transform; anim = GetComponent <Animator>(); bb1 = board1.GetComponent <BoardBehaviour>(); bb2 = board2.GetComponent <BoardBehaviour>(); pf = GetComponent <PlayerFollower>(); playerTags.Add("Bean"); playerTags.Add("Eal"); playerTags.Add("Loin"); playerTags.Add("Sage"); //DTAction a1 = new DTAction(FollowPlayer); //dt = new DecisionTree(a1); if (isServer) { //define decisions DTDecision d1 = new DTDecision(IsABoardActiveFor2Seconds); DTDecision d2 = new DTDecision(MoleIsAlive); DTDecision d3 = new DTDecision(IsABoardActiveFor5Seconds); DTDecision d4 = new DTDecision(AtLeastOneInAreaA); DTDecision d5 = new DTDecision(AtLeastTwoInAreaB); DTDecision d6 = new DTDecision(AtLeastOneInAreaC); DTDecision d7 = new DTDecision(AtLeastTwoInAreaC); DTDecision d8 = new DTDecision(MoleIsAlive); DTDecision d9 = new DTDecision(MoleIsAlive); //define actions DTAction a1 = new DTAction(TpAtActiveBoard); DTAction a2 = new DTAction(LoadRoundAttack); DTAction a3 = new DTAction(LoadFrontAttack); DTAction a4 = new DTAction(FollowClosestPlayer); DTAction a5 = new DTAction(FollowPlayerWithLessLives); DTAction a6 = new DTAction(FollowPlayerWithLessLivesInAreaC); d1.AddLink(true, d2); d1.AddLink(false, d4); d2.AddLink(true, d3); d2.AddLink(false, a1); d3.AddLink(true, a1); d3.AddLink(false, d4); d4.AddLink(true, d5); d4.AddLink(false, d6); d5.AddLink(true, a2); d5.AddLink(false, a3); d6.AddLink(true, d7); d6.AddLink(false, d8); d7.AddLink(true, d9); d7.AddLink(false, a4); d8.AddLink(true, a4); d8.AddLink(false, a5); d9.AddLink(true, a4); d9.AddLink(false, a6); dt = new DecisionTree(d1); StartCoroutine(Patrol()); } }