Beispiel #1
0
    private void Awake()
    {
        if (Instance == this)
        {
            //DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        _canvasRef = PlayerCanvas.Instance;
        _player    = ReInput.players.GetPlayer(_playerId);
        _playerRef = KyleplayerMove.Instance;

        _PauseMenu    = transform.GetChild(0).gameObject;
        _ControlsMenu = transform.GetChild(1).gameObject;

        _pauseMenuButtons = new List <Button>();
        for (int i = 0; i < _PauseMenu.transform.childCount; i++)
        {
            if (_PauseMenu.transform.GetChild(i).GetComponent <Button>())
            {
                _pauseMenuButtons.Add(_PauseMenu.transform.GetChild(i).gameObject.GetComponent <Button>());
            }
        }
        _currButton = 0;
        Debug.Log("init");
        _currScene = SceneManager.GetActiveScene().buildIndex;


        _pauseMenuButtons[_currButton].Select();
        _PauseMenu.SetActive(false);
        _ControlsMenu.SetActive(false);
    }
 public void AlertSquad(KyleplayerMove _playerToAttack)
 {
     for (int i = 0; i < _enemyList.Count; i++)
     {
         _enemyList[i].SetPlayer  = _playerToAttack;
         _enemyList[i].GetAIState = AIState.ALERTED;
     }
 }
    private void Awake()
    {
        _playerCam  = FindObjectOfType <PlayerCamera>().gameObject.GetComponent <Camera>();
        _playerMove = KyleplayerMove.Instance;
        player      = _playerMove.transform;
        _player     = ReInput.players.GetPlayer(0);

        _vertOffsetPercentage /= 100f;
    }
Beispiel #4
0
    private void Awake()
    {
        myscript     = LevelSelection_Script.Instance;
        _playerRef   = GetComponent <KyleplayerMove>();
        _canvasRef   = PlayerCanvas.Instance;
        _PcurrHealth = _PmaxHealth;

        _currentHealthBar = GameObject.Find("HealthBar").GetComponent <Image>();
    }
Beispiel #5
0
    private void Awake()
    {
        if (Instance == this)
        {
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        _playerRef = KyleplayerMove.Instance;
        Reset      = _playerRef.ResetPlayer;
    }
Beispiel #6
0
    public void Start()
    {
        _Player                 = ReInput.players.GetPlayer(_playerId);
        _playerCam              = FindObjectOfType <PlayerCamera>().gameObject.GetComponent <Camera>();
        _myPos                  = Vector3.zero;
        _myCanvas               = PlayerCanvas.Instance;
        _myCanvas.SetGameReset += InteractableReset;
        GameObject _ImageRef = Instantiate <GameObject>(InteractImagePrefab, _myPos, _myCanvas.transform.rotation, _myCanvas.transform);

        _myImage = _ImageRef;
        _myImage.SetActive(false);

        _playerRef = KyleplayerMove.Instance;
        switch (_whatAmI)
        {
        case TypeOfObject.DOOR:
            break;

        case TypeOfObject.POTION:
            transform.parent = null;
            break;

        case TypeOfObject.UPGRADE:
            _winRef = FindObjectOfType <WinCondition>();
            GameObject _killtext = Instantiate <GameObject>(_KillsTextPrefab, _myPos, _myCanvas.transform.rotation, _myCanvas.transform);
            _KillsToUnlockText = _killtext;
            _KillsToUnlockText.SetActive(false);

            transform.parent = null;
            break;

        case TypeOfObject.PUZZLE:
            break;

        case TypeOfObject.Mural:
            _MuralObj.SetActive(false);
            _MuralState = false;
            break;

        default:
            break;
        }
    }
    public virtual void Init()
    {
        _mainCanvas = PlayerCanvas.Instance.gameObject;
        _mainCanvas.GetComponent <PlayerCanvas>().SetGameReset += MyReset;
        _player     = KyleplayerMove.Instance;
        _berserkRef = FindObjectOfType <BerzerkMode>();
        _winRef     = FindObjectOfType <WinCondition>();
        _enemyAgent = GetComponent <NavMeshAgent>();
        _mySquad    = GetComponentInParent <EnemySquad>();
        _pauseRef   = PauseMenu.Instance;

        _patrolRoute = new List <Vector3>();
        for (int point = 0; point < _patrolPoints.Count; point++)
        {
            if (_patrolPoints[point])
            {
                _patrolRoute.Add(_patrolPoints[point].gameObject.transform.position);
            }
        }
        _startPoint = gameObject.transform.position;
        _patrolRoute.Add(_startPoint);
        _currPath = 0;

        _sword    = transform.GetChild(0).gameObject;
        _swordPos = _sword.transform.localPosition;
        _sword.SetActive(false);
        _bloodParticle = transform.GetChild(1).gameObject;

        _mainCam = PlayerCamera.Instance.gameObject.GetComponent <Camera>();

        GameObject _healthBar = Instantiate <GameObject>(_healthBarPrefab, _mainCanvas.transform);

        _actualHealthBar = _healthBar.GetComponent <Image>();
        _actualHealthBar.gameObject.SetActive(false);
        _currEnemyHealth = _enemyHealth;

        _enemyAgent.SetDestination(_patrolRoute[_currPath]);
        _myCurrState = AIState.NOTALERTED;
        _init        = true;
    }