public void Awake() { gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>(); centroX = this.transform.position.x; //CentroX es la posición actual del ovni-pajaro en el EJE X centroY = this.transform.position.y; //CentroY es la posición actual del ovni-pajaro en el EJE Y }
void Awake() { tiempoInicio = Time.time; gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>(); alerta = false; vidas = 5; }
void Update() { if (!morreu) { float distanciaTorre = Vector3.Distance(torreInimiga.transform.position, transform.position); // Atacando a torre if (distanciaTorre < raioTorre) { anim.SetBool("Atacar", true); Torre torre = torreInimiga.GetComponent <Torre>(); Atacar(torre, ATK, VEL); } else { // Atacar inimigo próximo GameObject atacarInimigo = inimigoProximo(); float distancia = raioAtaque; if (atacarInimigo != null) { distancia = Vector3.Distance(atacarInimigo.transform.position, transform.position); } if (distancia < raioAtaque) { anim.SetBool("Atacar", true); ControlPlayer inimigo = atacarInimigo.GetComponent <ControlPlayer>(); Atacar(inimigo, ATK, VEL); } // Mover até o inimigo próximo if (atacarInimigo != null && distancia > raioAtaque) { anim.SetBool("Atacar", false); anim.SetBool("Mover", true); transform.position = transform.position + velocidadeMov * (atacarInimigo.transform.position - transform.position).normalized; transform.forward = (atacarInimigo.transform.position - transform.position).normalized; } // Mover para a torre caso não tenha inimigo próximo if (atacarInimigo == null) { anim.SetBool("Atacar", false); anim.SetBool("Mover", true); transform.position = transform.position + velocidadeMov * (torreInimiga.transform.position - transform.position).normalized; transform.forward = (torreInimiga.transform.position - transform.position).normalized; } } } else { anim.SetBool("Morrer", true); tag = "Untagged"; Destroy(gameObject, 5.0f); } }
public void Awake() { gameManager = GameObject.Find("Player").GetComponent<ControlPlayer>(); centroX = this.transform.position.x; //CentroX es la posición actual del ovni-pajaro en el EJE X centroY = this.transform.position.y; //CentroY es la posición actual del ovni-pajaro en el EJE Y }
void Atacar(ControlPlayer inimigo, int ATK, int VEL) { if (Time.frameCount % velocidadeAtk == 0 && Time.frameCount != estabilidadeTempo) { inimigo.receberDano(4 * ATK); } estabilidadeTempo = Time.frameCount; }
/// <summary> /// This function will move through idle settlers forward and backwords depending on the bool /// </summary> /// <param name="next">Go to the next idle settler or the previous idle settler.</param> private void idleSettlerTab(bool next) { if (idleSettlers.Count == 0) { return; } ControlPlayer controlPlayer = AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>(); MonoBehaviour selectedObject = UnitManager.getInstance().controllerObj.GetComponent <ControlPlayer>().selectedObject; bool openSettlerWindow = false; if (selectedObject != null && selectedObject.gameObject.tag == "ControllableUnit" && AManager <GUIManager> .getInstance().GetComponent <HumanSettlerWindow>().entity == selectedObject) { openSettlerWindow = true; } if (!AManager <GUIManager> .getInstance().gameOver) { if (next) { currentIdleSettlerIndex++; //go to next settler if (currentIdleSettlerIndex >= idleSettlers.Count) //do we need to go to the begining of hte list? { currentIdleSettlerIndex = 0; } while (!idleSettlers[currentIdleSettlerIndex].isAlive()) //make sure it is not dead, if it is go to the next one. { currentIdleSettlerIndex++; if (currentIdleSettlerIndex >= idleSettlers.Count) { currentIdleSettlerIndex = 0; } } } else { currentIdleSettlerIndex--; //go to the previous settler if (currentIdleSettlerIndex < 0) //if we are at the begining of the list go to the last { currentIdleSettlerIndex = idleSettlers.Count - 1; } while (!idleSettlers[currentIdleSettlerIndex].isAlive()) //make sure we are not selecting dead settlers { currentIdleSettlerIndex--; if (currentIdleSettlerIndex < 0) { currentIdleSettlerIndex = idleSettlers.Count - 1; } } } } //move to the settler and select him AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().MoveToPosition(idleSettlers[currentIdleSettlerIndex].coordinate.world); AManager <WorldManager> .getInstance().controllerObj.GetComponent <ControlPlayer>().SelectObject(idleSettlers[currentIdleSettlerIndex].transform, openSettlerWindow); }
void Start() { controlPlayer = GameObject.FindWithTag("Player").GetComponent <ControlPlayer>(); if (spawnPoints.Length == 0) { Debug.LogError("No spawn points reference"); } WaveText.text = waves[nextWave].Name.ToString(); waveCountdown = TimeBetweenWaves; }
public GameObject FindCurrentPlayer() { ControlPlayer cp = FindObjectOfType <ControlPlayer>(); if (cp != null) { return(cp.gameObject); } return(null); }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D>(); gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>(); GameObject tmp = GameObject.FindGameObjectWithTag("Player"); if (tmp != null) { this.target = tmp.transform; } }
// Use this for initialization void Start() { rb = GetComponent<Rigidbody2D>(); gameManager = GameObject.Find("Player").GetComponent<ControlPlayer>(); GameObject tmp = GameObject.FindGameObjectWithTag("Player"); if (tmp != null) { this.target = tmp.transform; } }
void Start() { Player = GameObject.FindWithTag("Player"); PlayerControl = Player.GetComponent <ControlPlayer>(); int randomZombieType = Random.Range(1, 28); transform.GetChild(randomZombieType).gameObject.SetActive(true); zombieRigibody = GetComponent <Rigidbody>(); zombieAnimator = GetComponent <Animator>(); }
public void Instanciar() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this); } else if (this != Instance) { Destroy(this.gameObject); } }
void aplicarItem(ControlPlayer personagem) { if (personagem.HP + cura > personagem.HPMax) { personagem.HP = personagem.HPMax; } else { personagem.HP += cura; } gameObject.SetActive(false); }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("projectile")) { Debug.Log("[Enemies] Collide with projectile"); Destroy(gameObject); } if (collision.gameObject.CompareTag("Player")) { ControlPlayer ctplayer = collision.gameObject.GetComponent <ControlPlayer>(); ctplayer.declife(); Destroy(gameObject); Debug.Log("[Enemies] Collide with player"); } }
private void Awake() { controlPlayer = FindObjectOfType <ControlPlayer>(); findejuego = this; //if (gamemanager.AnimacionCrosshair == null) //{ // canvasmanageringame.PanelCrosshair.GetComponentInChildren<Animator>(); //} if (gamemanager.CamaraPlayer == null) { gamemanager.CamaraPlayer = FindObjectOfType <Camera>(); } controlPlayer.transform.position = new Vector3(1262.34f, 8.16f, 1218.6f); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { ControlPlayer player = other.transform.GetComponent <ControlPlayer>(); aplicarItem(player); Destroy(gameObject); } if (other.gameObject.CompareTag("Inimigo")) { ControlEnemy inimigo = other.transform.GetComponent <ControlEnemy>(); aplicarItem(inimigo); Destroy(gameObject); } }
void SetCameraTarget(Transform tr) { target = tr; if (target != null) { if (target.GetComponent <ControlPlayer>()) { playerController = target.GetComponent <ControlPlayer>(); } else { Debug.LogError("The camera's target needs a character controller"); } } else { Debug.LogError("Camera doesn't have target"); } }
internal void Awake() { m_physics = GetComponent <BasicPhysics>(); m_lastInput = new Vector2(); m_aiCustomControl = GetComponent <ControlAI>(); m_playerCustomControl = GetComponent <ControlPlayer>(); m_orient = GetComponent <Orientation>(); m_eqp = GetComponent <InventoryContainer>(); m_trueAverageVelocity = new Vector3(); lastPos = transform.position; if (CanJump) { SetJumpHeight(JumpHeight); } updateCustomControl(); if (GetComponent <PersistentItem>() != null) { GetComponent <PersistentItem>().InitializeSaveLoadFuncs(storeData, loadData); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { player = other.transform.GetComponent <ControlPlayer>(); aplicarItem(player); ParticleSystem [] part = other.gameObject.GetComponentsInChildren <ParticleSystem>(); part[1].Play(); Destroy(gameObject, 15.0f); } if (other.gameObject.CompareTag("Inimigo")) { inimigo = other.transform.GetComponent <ControlEnemy>(); aplicarItem(inimigo); ParticleSystem[] part = other.gameObject.GetComponentsInChildren <ParticleSystem>(); part[1].Play(); Destroy(gameObject, 15.0f); } }
void Awake() { gameManager = GameObject.Find("Player").GetComponent<ControlPlayer>(); alerta = false; vidas = 5; }
void aplicarItem(ControlPlayer personagem) { personagem.DEFBonus -= def; gameObject.SetActive(false); }
void desfazerItem(ControlPlayer personagem) { personagem.DEFBonus += def; gameObject.SetActive(false); }
void desfazerItem(ControlPlayer personagem) { personagem.ATK -= atk; gameObject.SetActive(false); }
void aplicarItem(ControlPlayer personagem) { personagem.ATK += atk; gameObject.SetActive(false); }
// Use this for initialization void Start() { gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>(); }
public void Start() { guiMgr = AManager<GUIManager>.getInstance(); windowRect = new Rect(0f, 0f, Screen.width, Screen.height); windowViewRect = new Rect(0f, 0f, Screen.width, Screen.height); this.controller = GUIManager.getInstance().controllerObj.GetComponent<ControlPlayer>(); countdown = 0f; }
private void Awake() { this.Instanciar(); controlPlayer = FindObjectOfType <ControlPlayer>(); }
void aplicarItem(ControlPlayer personagem) { }
public void Start() { bShowMilitary = false; bShowCivilian = false; windowRect = new Rect(0f, 0f, this.intendedWindowWidth, 320f); windowViewRect = new Rect(0f, 0f, this.intendedWindowWidth, 320f); this.scrollPosition = Vector2.zero; this.horizontalScrollPosition = Vector2.zero; this.controller = GUIManager.getInstance().controllerObj.GetComponent<ControlPlayer>(); PartyManager.PartySize = 0; openDraft = false; }
// Start is called before the first frame update void Start() { instance = this; theCamera = GameObject.FindGameObjectWithTag("MainCamera"); }
void Awake() { gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>() ; }
void Awake() { gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>(); alerta = false; vidas = 5; }