Example #1
0
    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
    }
Example #2
0
 void Awake()
 {
     tiempoInicio = Time.time;
     gameManager  = GameObject.Find("Player").GetComponent <ControlPlayer>();
     alerta       = false;
     vidas        = 5;
 }
Example #3
0
    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);
        }
    }
Example #4
0
    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

    }
Example #5
0
    void Atacar(ControlPlayer inimigo, int ATK, int VEL)
    {
        if (Time.frameCount % velocidadeAtk == 0 && Time.frameCount != estabilidadeTempo)
        {
            inimigo.receberDano(4 * ATK);
        }

        estabilidadeTempo = Time.frameCount;
    }
Example #6
0
        /// <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;
 }
Example #8
0
    public GameObject FindCurrentPlayer()
    {
        ControlPlayer cp = FindObjectOfType <ControlPlayer>();

        if (cp != null)
        {
            return(cp.gameObject);
        }
        return(null);
    }
Example #9
0
    // 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;
        }
    }
Example #10
0
    // 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;
        }

    }
Example #11
0
    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>();
    }
Example #12
0
 public void Instanciar()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else if (this != Instance)
     {
         Destroy(this.gameObject);
     }
 }
Example #13
0
    void aplicarItem(ControlPlayer personagem)
    {
        if (personagem.HP + cura > personagem.HPMax)
        {
            personagem.HP = personagem.HPMax;
        }
        else
        {
            personagem.HP += cura;
        }

        gameObject.SetActive(false);
    }
Example #14
0
 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");
     }
 }
Example #15
0
    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);
    }
Example #16
0
    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);
        }
    }
Example #17
0
    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");
        }
    }
Example #18
0
 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);
     }
 }
Example #19
0
    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);
        }
    }
Example #20
0
    void Awake()
    {
        gameManager = GameObject.Find("Player").GetComponent<ControlPlayer>();
        alerta = false;
		vidas = 5;
    }
Example #21
0
 void aplicarItem(ControlPlayer personagem)
 {
     personagem.DEFBonus -= def;
     gameObject.SetActive(false);
 }
Example #22
0
 void desfazerItem(ControlPlayer personagem)
 {
     personagem.DEFBonus += def;
     gameObject.SetActive(false);
 }
Example #23
0
 void desfazerItem(ControlPlayer personagem)
 {
     personagem.ATK -= atk;
     gameObject.SetActive(false);
 }
Example #24
0
 void aplicarItem(ControlPlayer personagem)
 {
     personagem.ATK += atk;
     gameObject.SetActive(false);
 }
Example #25
0
 // 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;
 }
Example #27
0
 private void Awake()
 {
     this.Instanciar();
     controlPlayer = FindObjectOfType <ControlPlayer>();
 }
Example #28
0
 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");
    }
Example #31
0
 void Awake()
 {
     gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>() ;
 }
Example #32
0
 void Awake()
 {
     gameManager = GameObject.Find("Player").GetComponent <ControlPlayer>();
     alerta      = false;
     vidas       = 5;
 }