Ejemplo n.º 1
0
    public bool UsingPlayerEnergy()
    {
        // player get phase down when spawning the attacker
        if (LandMgr.GetInstance().IsPhaseDown())
        {
            if (playerEnergy - energyAttackerCost < 0)
            {
                CreateTextPlayerEnergy(energyAttackerCost, true);
                return(false);
            }

            playerEnergy            -= energyAttackerCost;
            sliderPlayerEnergy.value = playerEnergy / maxEnergy;
            CreateTextPlayerEnergy(energyAttackerCost, false);
        }
        // player get phase up when spawning the defender
        if (LandMgr.GetInstance().IsPhaseUp())
        {
            if (playerEnergy - energyDefenderCost < 0)
            {
                CreateTextPlayerEnergy(energyDefenderCost, true);
                return(false);
            }

            playerEnergy            -= energyDefenderCost;
            sliderPlayerEnergy.value = playerEnergy / maxEnergy;
            CreateTextPlayerEnergy(energyDefenderCost, false);
        }
        return(true);
    }
Ejemplo n.º 2
0
    public void OnPressButtonOK()
    {
        Reset();

        LandMgr.GetInstance().ChangePhaseGame();
        Owner.ChangeState(Owner.m_sceneInGame);
    }
Ejemplo n.º 3
0
 private void Reset()
 {
     // reset Mgr
     GameMgr.GetInstance().Reset();
     LandMgr.GetInstance().Reset();
     SpawnMgr.GetInstance().ResetEnergy();
     finder.Reset();
 }
Ejemplo n.º 4
0
    public void SpawnDefender(Vector3 position)
    {
        if (LandMgr.GetInstance().IsPhaseDown())
        {
            tmp = Instantiate(prefabDefender, position, Quaternion.Euler(0f, 180f, 0f));
        }
        if (LandMgr.GetInstance().IsPhaseUp())
        {
            tmp = Instantiate(prefabDefender, position, Quaternion.Euler(0f, 0f, 0f));
        }

        listDefender.Add(tmp);
    }
Ejemplo n.º 5
0
 public void CheckPhaseWinInGate(bool hasBall)
 {
     // Gate: attacker spawning in phase down is player -> player win
     if (LandMgr.GetInstance().IsPhaseDown() && hasBall)
     {
         SetPhasePlayerWin();
     }
     // Gate: attacker spawning in phase up is enemy -> enemy win
     if (LandMgr.GetInstance().IsPhaseUp() && hasBall)
     {
         SetPhaseEnemywin();
     }
 }
Ejemplo n.º 6
0
 public void CheckPhaseWinOfAttacker()
 {
     // attacker spawning in phase down is player -> enemy win
     if (LandMgr.GetInstance().IsPhaseDown())
     {
         SetPhaseEnemywin();
     }
     // attacker spawning in phase up is enemy -> player win
     if (LandMgr.GetInstance().IsPhaseUp())
     {
         SetPhasePlayerWin();
     }
 }
Ejemplo n.º 7
0
    public bool CheckValidPostion(Transform tran)
    {
        if (LandMgr.GetInstance().IsPhaseDown())
        {
            return(tran.position.z < 12);
        }
        if (LandMgr.GetInstance().IsPhaseUp())
        {
            return(tran.position.z > -12);
        }

        return(false);
    }
Ejemplo n.º 8
0
    public void SetBallRandomPosition(Transform tranBall)
    {
        if (LandMgr.GetInstance().IsPhaseDown())
        {
            float randX = Random.Range(-7.5f, 7.5f);
            float randZ = Random.Range(-12f, 0f);

            tranBall.position = new Vector3(randX, 0f, randZ);
        }
        if (LandMgr.GetInstance().IsPhaseUp())
        {
            float randX = Random.Range(-7.5f, 7.5f);
            float randZ = Random.Range(0f, 12f);

            tranBall.position = new Vector3(randX, 0f, randZ);
        }
    }
Ejemplo n.º 9
0
    public void CreateTheBall()
    {
        if (LandMgr.GetInstance().IsPhaseDown())
        {
            float randX = Random.Range(-7.5f, 7.5f);
            float randZ = Random.Range(-12f, 0f);

            ballTmp = Instantiate(prefabBall, new Vector3(randX, 0f, randZ), Quaternion.identity);
        }
        if (LandMgr.GetInstance().IsPhaseUp())
        {
            float randX = Random.Range(-7.5f, 7.5f);
            float randZ = Random.Range(0f, 12f);

            ballTmp = Instantiate(prefabBall, new Vector3(randX, 0f, randZ), Quaternion.identity);
        }
    }