Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        nextGoal = startState;
        currGoal = goals.ZERO;

        physical = this.GetComponent <Rigidbody2D>();
        clicker  = this.GetComponent <Clickable>();
        anim     = GetComponent <Animator>();
        sprite   = GetComponent <SpriteRenderer>();

        if (clicker != null)
        {
            clicker.setClickDownCallback(wasMouseDowned);
            clicker.setClickReleaseCallback(wasMouseUpped);
        }

        if (mousey == null)
        {
            mousey = FindObjectOfType <MouseBehaviour>();
        }

        currentHunger = maxHunger;
        currEmote     = emotes.NEUTRAL;
        maturityTimer = WeightedRandomRange(maturityVariance, maturityTime);
    }
        private void Start()
        {
            _MaxHP = Health;
            _HP    = Health;
            float   tempHeight = PlayerHeight / 2f;
            Vector3 tempVec    = new Vector3(0f, tempHeight, 0f);

            ObjectCentre          = tempVec;
            PlayerBody.center     = tempVec;
            PlayerBody.height     = PlayerHeight;
            tempVec               = new Vector3(0f, PlayerHeight, 0f);
            Camera.localPosition  = tempVec;
            tempVec.y             = PlayerHeight * 0.35f;
            PlayerStepBody.radius = PlayerBody.height / 2f * 0.58f;
            tempVec.z             = PlayerStepBody.radius - PlayerBody.radius;
            PlayerStepBody.center = tempVec;
            MouseBehaviour.LockMouse();
            if (UIManager.instance == null)
            {
                if (UIPrefab != null)
                {
                    Instantiate(UIPrefab);
                }
            }
            if (UIManager.instance != null)
            {
                UIManager.instance.InitializeHP(_HP);
            }
        }
Example #3
0
 public void Resume()
 {
     pauseMenuUI.SetActive(false);
     Time.timeScale = 1f;
     IsGamePaused   = false;
     MouseBehaviour.LockMouse();
 }
Example #4
0
    // Start is called before the first frame update
    void Start()
    {
		mouse = Camera.main.GetComponent<MouseBehaviour>();
		yOffset = spriteRend.bounds.extents.y;
		xExtent = spriteRend.bounds.extents.x;
        Debug.Log(yOffset);
    }
Example #5
0
    private void SetSecondItemPosition(GameObject item)
    {
        //Change to the postion of second item latter
        item.transform.position = new Vector3(20, -4f, -4);
        MouseBehaviour mouseDrag = item.GetComponent <MouseBehaviour>();

        mouseDrag.SetOriginPosition(new Vector3(20, -4f, -4));
    }
Example #6
0
    // Use this for initialization
    void Awake()
    {
//		PlayerLocation = new Vector3 (Player.transform.position.x, Player.transform.position.y, Player.transform.position.z);

        nma = GetComponent <NavMeshAgent> ();

        Player      = GameObject.FindGameObjectWithTag("Player");
        ScriptStuff = Player.GetComponentInChildren <Camera> ().GetComponent <MouseBehaviour> ();
//		Events = gameObject.GetComponent<MouseBehaviour> ();
    }
Example #7
0
    // Start is called before the first frame update
    void Start()
    {
        player = FindObjectOfType <Player>();

        buyButton.onClick.AddListener(onBuyCritter);
        foodButton.onClick.AddListener(onFoodModeToggle);

        spawner = GameObject.FindGameObjectWithTag("spawner").GetComponent <SpreadSpawner>();

        player.registerMoneyChange(newMoneyAmount);
        newMoneyAmount(player.startMoney);

        mouse = GameObject.FindObjectOfType <MouseBehaviour>();
    }
        private void HandleInput()
        {
            if (MouseBehaviour.MouseLocked)
            {
                InputX         = Input.GetAxis("Mouse X");
                InputY         = Input.GetAxis("Mouse Y");
                MoveHorizontal = Input.GetAxis("Horizontal");
                MoveVertical   = Input.GetAxis("Vertical");
                if (Input.GetKeyDown(KeyCode.LeftShift))
                {
                    _isRuning = true;
                    try {
                        MoveSwitched(walking, _isRuning);
                    } catch {
                    }
                }
                if (Input.GetKeyUp(KeyCode.LeftShift))
                {
                    _isRuning = false;
                    try{
                        MoveSwitched(walking, _isRuning);
                    }catch {
                    }
                }
                _jump = false;
                if (Input.GetKeyDown(KeyCode.Space))
                {
                    _jump = true;
                }
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    MouseBehaviour.UnlockMouse();
                    InputX         = 0f;
                    InputY         = 0f;
                    MoveHorizontal = 0f;
                    MoveVertical   = 0f;
                    _isRuning      = false;
                }
            }
            else
            {
//				if (Input.GetMouseButtonDown(0)) {
//					MouseBehaviour.LockMouse();
//				}
            }
        }
Example #9
0
    void Start()
    {
        _gm     = FindObjectOfType <GameManager>();
        _mouse  = FindObjectOfType <MouseBehaviour>();
        id      = -1;
        _prices = new int[_seedsPrice.Length];

        for (int i = 0; i < _seedsPrice.Length; i++)
        {
            _price = i + 1;
            if (i >= 2)
            {
                _price = _price + 1;
            }
            _prices[i]          = _price;
            _seedsPrice[i].text = "Cost : " + _price.ToString();
        }
    }
Example #10
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(BestResult);
//		BestResultInt = BestResult;
        EnemyLeftText.text = "Enemy Left: " + Enemies.Count;

        if (Enemies.Count == 0 && IsNotCHangedLVL)
        {
            ThisLVLCompliteText.gameObject.SetActive(true);
            Trophy.SetActive(true);
            Trophy.transform.Rotate(new Vector3(0f, 1f, 0));
        }
        else
        {
            Trophy.SetActive(false);
            Trophy.transform.Rotate(new Vector3(0f, 0f, 0));
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (IsGamePaused)
            {
                Resume();
                MouseBehaviour.LockMouse();
                Cursor.lockState = CursorLockMode.Locked;
                Cursor.visible   = false;
            }
            else
            {
                Pause();
            }
        }


        if (PeaceCount <= 1)
        {
            CanUseRiffle = false;
        }
        else
        {
            CanUseRiffle = true;
        }

        if (PeaceCount < 10)
        {
            CanUseRPG = false;
        }
        else
        {
            CanUseRPG = true;
        }

        if (PeaceCount < 5)
        {
            CanUseGrenade = false;
        }
        else
        {
            CanUseGrenade = true;
        }
    }
Example #11
0
 // Start is called before the first frame update
 void Start()
 {
     hudState = HUDState.BASE;
     RefreshHUDSDisplay();
     mouse = Camera.main.GetComponent <MouseBehaviour>();
 }