コード例 #1
0
 void OnGUI()
 {
     if (actif)
     {
         GUI.Label(new Rect(Screen.width * 0.02f, Screen.height * 0.02f, Screen.width * 0.5f, Screen.height * 0.1f), "Actions Restantes: " + speed +
                   ", Vie: " + vie + "/" + vieMaximale + ", Attaque: " + attaque);
     }
     if (vie <= 0)
     {
         float decalageGauche = (Screen.width - Screen.width * 0.333f) / 2;
         GUI.Label(new Rect(decalageGauche - Screen.width * 0.25f, Screen.height * 0.25f, Screen.width * 2f, Screen.height * 0.4f),
                   "<color=white><size=30>Vous avez été tué par " + getKillerName() + ".</size></color>");
         if (GUI.Button(new Rect(decalageGauche, Screen.height * 0.45f, Screen.width * 0.3f, Screen.height * 0.1f), "Rejouer"))
         {
             TileManager.getInstance().resetTiles();
             EnemyManager.getInstance().restartEnemies();
             FogManager.getInstance().restartFog();
             Application.LoadLevel("Main");
         }
         if (GUI.Button(new Rect(Screen.width * 0.333f, Screen.height * 0.65f, Screen.width * 0.3f, Screen.height * 0.1f), "Quitter"))
         {
             Application.Quit();
         }
     }
 }
コード例 #2
0
 void OnGUI()
 {
     if (GUI.Button(new Rect(Screen.width * 0.35f, Screen.height * 0.65f, Screen.width * 0.3f, Screen.height * 0.1f), "Rejouer"))
     {
         TileManager.getInstance().resetTiles();
         EnemyManager.getInstance().restartEnemies();
         FogManager.getInstance().restartFog();
         Application.LoadLevel("Main");
     }
     if (GUI.Button(new Rect(Screen.width * 0.35f, Screen.height * 0.85f, Screen.width * 0.3f, Screen.height * 0.1f), "Quitter"))
     {
         Application.Quit();
     }
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        tileManager  = TileManager.getInstance();
        enemyManager = EnemyManager.getInstance();
        turnManager  = TurnManager.getInstance();
        fogManager   = FogManager.getInstance();

        adjustBackground();
        generateTiles();
        generateFog();

        generateZombies();
        generateEnnemis();
        generatePowerUps();
    }
コード例 #4
0
    public void updateEnemy(int index)
    {
        EnemyScript enemy = lesEnemies[index];

        if (lesEnemies[index] != null)
        {
            if (!FogManager.getInstance().isFog(enemy.getX(), enemy.getY()))
            {
                lesEnemies[index].actif = true;
                lesEnemies[index].StartActions();
            }
            else
            {
                TurnManager.getInstance().nextEnemy();
            }
        }
        else
        {
            TurnManager.getInstance().nextEnemy();
        }
    }
コード例 #5
0
    // Update is called once per frame
    void Update()
    {
        if (actif)
        {
            base.Update();

            if ((sex == "F" && Input.GetKeyDown(KeyCode.RightArrow)) || (sex == "M" && Input.GetKeyDown(KeyCode.D)))
            {
                if (checkNearby(1, 0))
                {
                    if (side == -1)
                    {
                        side = 1;
                    }
                    transform.localScale = new Vector3(4 * side, 4, 0);
                    MoveRight();
                    FogManager.getInstance().unFog(getX(), getY());
                }
            }


            if ((sex == "F" && Input.GetKeyDown(KeyCode.LeftArrow)) || (sex == "M" && Input.GetKeyDown(KeyCode.A)))
            {
                if (checkNearby(-1, 0))
                {
                    if (side == 1)
                    {
                        side = -1;
                    }
                    transform.localScale = new Vector3(4 * side, 4, 1);
                    MoveLeft();
                    FogManager.getInstance().unFog(getX(), getY());
                }
            }

            if ((sex == "F" && Input.GetKeyDown(KeyCode.UpArrow)) || (sex == "M" && Input.GetKeyDown(KeyCode.W)))
            {
                if (checkNearby(0, 1))
                {
                    transform.localScale = new Vector3(4 * side, 4, 1);
                    MoveForward();
                    FogManager.getInstance().unFog(getX(), getY());
                }
            }

            if ((sex == "F" && Input.GetKeyDown(KeyCode.DownArrow)) || (sex == "M" && Input.GetKeyDown(KeyCode.S)))
            {
                if (checkNearby(0, -1))
                {
                    transform.localScale = new Vector3(4 * side, 4, 1);
                    MoveBackward();
                    FogManager.getInstance().unFog(getX(), getY());
                }
            }

            if (vie <= 0)
            {
                actif = false;
                SoundScript.Instance.MakePlayerDeathSound();
            }


            if (attackCount > 0)
            {
                attackCount--;
            }
        }

        anim.SetFloat("vitesse", movementUnit);
        anim.SetInteger("attackCount", attackCount);
        anim.SetInteger("life", vie);
    }