Inheritance: BaseGUI
Ejemplo n.º 1
0
 public static void removeLevelGUI()
 {
     if (levelGUI)
     {
         GameObject.Destroy(levelGUI.gameObject);
         levelGUI = null;
     }
 }
Ejemplo n.º 2
0
 public StatFlame(Mod mod, LevelGUI levelGUI, STAT id, Func <Vector2> position, Texture2D texture)
 {
     this.mod      = mod;
     this.levelGUI = levelGUI;
     this.id       = id;
     this.position = position;
     this.texture  = texture;
     this.counter  = (int)id * 8;
 }
Ejemplo n.º 3
0
Archivo: NPC.cs Proyecto: dringy/Hackar
    public void checkForPlayer()
    {
        //The npc only does something if it doesn't ignore the player
        if (action != playerAction.Ignore)
        {
            PlayerController player;
            //It then attempts to spot a player given it's direction, sightlength and spotlength
            //It calls EnviromentMap functions for this
            switch (directionFacing)
            {
            case direction.posotiveX:
            {
                player = EnviromentMap.findPlayerLookingPosotiveX(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }

            case direction.negativeX:
            {
                player = EnviromentMap.findPlayerLookingNegativeX(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }

            case direction.posotiveZ:
            {
                player = EnviromentMap.findPlayerLookingPosotiveZ(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }

            default:
            {
                player = EnviromentMap.findPlayerLookingNegativeZ(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }
            }

            //If a player was found we can then act
            if (player != null)
            {
                //If the kill action is present then we reset the level
                if (action == playerAction.Kill)
                {
                    Application.LoadLevel(Application.loadedLevelName);
                }
                //If the teleport ation is present we display a times message and teleport the player
                else
                {
                    LevelGUI.displayTimedMessage(this.name + " spotted you and teleported you.");
                    //player.triggerWalkAwayDueToTeleport ();
                    EnviromentMap.moveTo(teleX, teleY, teleZ, player);
                }
            }
        }
    }
Ejemplo n.º 4
0
 public static LevelGUI getLevelGUI()
 {
     if (!levelGUI)
     {
         //GameObject levelGUIGameObject = GameObject.Instantiate(Resources.Load("Prefabs/GUI/LevelGUI", typeof(GameObject))) as GameObject;
         GameObject levelGUIGameObject = GameObject.Find("LevelGUI");
         levelGUIGameObject.name = "LevelGUI";
         levelGUI = levelGUIGameObject.GetComponent <LevelGUI>();
     }
     return(levelGUI);
 }
Ejemplo n.º 5
0
 public static LevelGUI getLevelGUI()
 {
     if (!levelGUI)
     {
         //GameObject levelGUIGameObject = GameObject.Instantiate(Resources.Load("Prefabs/GUI/LevelGUI", typeof(GameObject))) as GameObject;
         GameObject levelGUIGameObject = GameObject.Find("LevelGUI");
         levelGUIGameObject.name = "LevelGUI";
         levelGUI = levelGUIGameObject.GetComponent<LevelGUI>();
     }
     return levelGUI;
 }
Ejemplo n.º 6
0
 //When the mouse if over the object and the user clicks then the Hack GUI is updated
 void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
     {
         if (isHackLocked)
         {
             LevelGUI.displayTimedMessage(name + " is hack locked.");
         }
         else
         {
             LevelGUI.displayGUI(this);
         }
     }
 }
Ejemplo n.º 7
0
    public virtual void Awake()
    {
        if (instance != null)
        {
            Debug.Log("Only one LevelGUI can exist at a time.");
            Destroy(this);
        }
        else
        {
            instance = this;
            setup    = new Action[] { null, SetEndOfGame, null };

            stateActions = new Action[Enum.GetNames(typeof(EState)).Length];
            stateActions[(int)EState.Playing]     = DrawPlaying;
            stateActions[(int)EState.Ended]       = DrawEndOfGame;
            stateActions[(int)EState.HumanKilled] = DrawHumanKilled;
        }
    }
Ejemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        this.GetComponent <UIRoot>().manualHeight = Screen.height;
        root = this.GetComponent <UIRoot>();

        messages = new List <TextMessage>();
        TextMessage fakeTextMessage = new TextMessage();

        fakeTextMessage.duration = 0;
        messages.Add(fakeTextMessage);
        powerJoy = -1;

        _levelGUI = this;

        //Register for global vars and powers events
        GlobalManager.globalManager.onPopulationChanged += changePopulation;
        GlobalManager.globalManager.onScoreChanged      += changeDeath;
        GlobalManager.globalManager.onSoulsChanged      += changeSouls;

        PowersManager.powersManager.powerEnabled  += changePowersEnabled;
        PowersManager.powersManager.powerDisabled += changePowersDisabled;
    }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        //We first call super class function
        base.Update();

        bool moved = false;         //moved indicates that the user has attempted to move

        //We are only allowed to move if there are no holds on the player
        if (!isHeld())
        {
            moved = true;
            //Here we check for the arrow keys inputs and WASD inputs for movement, the turn based controller is then prompted after the movement
            if ((Input.GetKeyDown(KeyCode.UpArrow)) || (Input.GetKeyDown(KeyCode.W)))
            {
                moveSightWise(1);
                TurnBasedController.advanceTurn();
            }
            else if ((Input.GetKeyDown(KeyCode.DownArrow)) || (Input.GetKeyDown(KeyCode.S)))
            {
                moveSightWise(-1);
                TurnBasedController.advanceTurn();
            }
            else if ((Input.GetKeyDown(KeyCode.LeftArrow)) || (Input.GetKeyDown(KeyCode.A)))
            {
                moveSideWays(1);
                TurnBasedController.advanceTurn();
            }
            else if ((Input.GetKeyDown(KeyCode.RightArrow)) || (Input.GetKeyDown(KeyCode.D)))
            {
                moveSideWays(-1);
                TurnBasedController.advanceTurn();
            }
            //If the user preses space it indicates that they are waiting and the enviroment will advance a turn
            else if (Input.GetKeyDown(KeyCode.Space))
            {
                TurnBasedController.advanceTurn();
            }
            //If no movement commands are issues then we mark it as false
            else
            {
                moved = false;
            }
        }
        //Q and E rotate the camera, Q by 90 degrees and E by 270 degrees (equal to -90 degrees)
        //The camera offset which is used to ensure the movement keys are relative also have to be changed here
        if (Input.GetKeyDown(KeyCode.Q))
        {
            rotateClockwise();
            if (++offSet > 7)
            {
                offSet -= 8;
            }
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            rotateAntiClockwise();
            if (--offSet < 0)
            {
                offSet += 8;
            }
        }
        //Empty else-if statement for tab is used here so the disableGUI() function is called which is the only function needed for Tab
        else if (Input.GetKeyDown(KeyCode.Tab))
        {
            ;
        }
        //Escape loads the main menu level
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.LoadLevel("MainMenu");
        }
        //R loads the same level we're on
        else if (Input.GetKeyDown(KeyCode.R))
        {
            Application.LoadLevel(Application.loadedLevelName);
        }
        //If we haven't moved we return to avoid calling disableGUI()
        else if (!moved)
        {
            return;
        }
        //If any control has been pressed the GUI is disabled to prevent positioning issues and inconsistency issues
        LevelGUI.disableGUI();
    }
Ejemplo n.º 10
0
 /// <summary>
 /// Displays the step limit message.
 /// </summary>
 private void displayStepLimitMessage()
 {
     //If we run out of steps we display a timed message
     LevelGUI.displayTimedMessage("Exceeded Step Limit");
 }
Ejemplo n.º 11
0
 void OnDestroy()
 {
     instance = null;
 }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     mainCam = Camera.main;
     roads = new ArrayList ();
     simObjects = new ArrayList ();
     gui = GameObject.Find (Constants.levelGUIGOName);
     lgui = gui.GetComponent<LevelGUI> ();
 }
Ejemplo n.º 13
0
 // Sets the instance to null when the application quits
 public void OnApplicationQuit()
 {
     instance = null;
 }
Ejemplo n.º 14
0
 public static void removeLevelGUI()
 {
     if (levelGUI)
     {
         GameObject.Destroy(levelGUI.gameObject);
         levelGUI = null;
     }
 }
Ejemplo n.º 15
0
 void Start()
 {
     _movementController = GameObject.FindGameObjectWithTag("Player").GetComponent<MovementController>();
     _gravityController = GameObject.FindGameObjectWithTag("Player").GetComponent<GravityController>();
     _jumpingController = GameObject.FindGameObjectWithTag("Player").GetComponent<JumpingController>();
     _player = GameObject.FindGameObjectWithTag("Player");
     _levelGUI = GameObject.FindGameObjectWithTag("Level GUI").GetComponent<LevelGUI>();
     _startPosition = new Vector3(_player.transform.position.x, _player.transform.position.y, _player.transform.position.z);
     _startScale = new Vector3(_player.transform.localScale.x, _player.transform.localScale.y, _player.transform.localScale.z);
     _player.transform.localScale = new Vector3(0,0,0);
 }
Ejemplo n.º 16
0
	void Start()
	{
		instance = this;
		countdown = Instantiate(CountdownPrefab, Vector3.one, Quaternion.identity) as Countdown;
	}