Exemplo n.º 1
0
 void Start()
 {
     if (m_Character == null && Root.Instance != null)
     {
         m_Character = Root.Instance.m_Character;
     }
 }
Exemplo n.º 2
0
    private void Update()
    {
        if (_player == null)
        {
            _player = FindObjectOfType <PlayerCharacterController>();
        }

        _bar.fillAmount = Mathf.Clamp01((float)_player.CurrentHealth / _player.MaxHealth);
    }
Exemplo n.º 3
0
    void OnPicked(PlayerCharacterController player)
    {
        PlayerCharacterController playerPlayerCharacterController = player.GetComponent <PlayerCharacterController>();

        playerPlayerCharacterController.SetGravity(NewGravity, jumppower);

        m_Pickup.PlayPickupFeedback();

        Destroy(gameObject);
    }
Exemplo n.º 4
0
    void OnInteract(GameObject caller)
    {
        m_PlayerSpellsManager       = caller.GetComponent <PlayerSpellsManager>();
        m_PlayerCharacterController = caller.GetComponent <PlayerCharacterController>();
        m_PlayerInputHandler        = caller.GetComponent <PlayerInputHandler>();

        m_PlayerCharacterController.paused = true;
        waitingForSpellBinding             = true;
        textBox.SetActive(true);
    }
    // Use this for initialization
    void Start()
    {
        animator = transform.GetComponent <Animator>();

        pController = PlayerCharacterController.Instance;

        //ensure these have a starting value
        animator.SetBool("isFired", false);
        animator.SetBool("isReloading", false);
    }
Exemplo n.º 6
0
    private void SpawnPlayer(PlayerCharacterController p)
    {
        int           remainingUnusedSpawners = unallocatedSpawners.Count;
        int           randomSpawnIndex        = Random.Range(0, remainingUnusedSpawners);
        PlayerSpawner spawner = unallocatedSpawners[randomSpawnIndex];

        unallocatedSpawners.Remove(spawner);
        spawner.SetSpawnObject(p.GetShopkin().gameObject);
        spawner.Spawn();
    }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        player         = GameObject.Find("PlayerCharacter").GetComponent <PlayerCharacterController>();
        switcher       = this.transform.FindChild("SizeIcon").gameObject.GetComponent <SpriteSwitcher>();
        iconOverFrame  = GameObject.Find("SizeIconOverFrame").GetComponent <Image>();
        m_iconImage    = GameObject.Find("SizeIcon").GetComponent <Image>();
        m_characterNum = (int)SceneData.characterSelect;

        HealthStateEnterProcess();
    }
Exemplo n.º 8
0
    // Use this for initialization
    void Start()
    {
        m_frame       = GetComponent <Image>();
        m_frame.color = new Color(m_frame.color.r, m_frame.color.g, m_frame.color.b, 0);

        //m_frame.enabled = false;
        //  m_frame.rectTransform.sizeDelta = new Vector2(Screen.width, Screen.height);
        m_flashTime = m_flashingMaxTime;
        m_player    = GameObject.Find("PlayerCharacter").GetComponent <PlayerCharacterController>();
    }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        m_mainCamera = GameObject.Find("MainCamera").GetComponent <Camera>();
        if (m_imageSample)
        {
            m_image = m_imageSample.GetComponent <Image>();
        }

        m_player = GameObject.Find("PlayerCharacter").GetComponent <PlayerCharacterController>();
    }
Exemplo n.º 10
0
        public void OnPlayerEnter(GameObject player)
        {
            PlayerCharacterController playerController = player.GetComponent <PlayerCharacterController>();
            Rigidbody2D rigidBody = player.GetComponent <Rigidbody2D>();
            Vector2     direction = rigidBody.velocity.normalized;

            playerController.DisableInputAndMoveForSeconds(settings.goBackDuration, -direction);

            dialogPlayer.PlayDialog(dialogList);
        }
Exemplo n.º 11
0
    void Awake()
    {
        PlayerCharacterController playerCharacterController = FindObjectOfType <PlayerCharacterController>();

        DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, Compass>(playerCharacterController, this);
        m_PlayerTransform = playerCharacterController.transform;

        m_WidthMultiplier = compasRect.rect.width / visibilityAngle;
        m_heightOffset    = -compasRect.rect.height / 2;
    }
Exemplo n.º 12
0
    private void LateUpdate()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject);
        m_GameFlowManager = FindObjectOfType <GameFlowManager>();
        DebugUtility.HandleErrorIfNullFindObject <GameFlowManager, PlayerInputHandler>(m_GameFlowManager, this);


        m_FireInputWasHeld = GetFireInputHeld();
    }
Exemplo n.º 13
0
    void Start()
    {
        m_Player = FindObjectOfType <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, GameFlowManager>(m_Player, this);

        m_ObjectiveManager = FindObjectOfType <ObjectiveManager>();
        DebugUtility.HandleErrorIfNullFindObject <ObjectiveManager, GameFlowManager>(m_ObjectiveManager, this);

        AudioUtility.SetMasterVolume(1);
    }
Exemplo n.º 14
0
    private void Start()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject);

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;

        GameManager.Instance.OnGameStateChanged.AddListener(HandleGameStateChanged);
    }
 // Start is called before the first frame update
 void Start()
 {
     playerRef = PlayerCharacterController.request();
     animRef   = gameObject.GetComponent <AnimationController>();
     playerRef.startGame.AddListener(gameStarted);
     targetPos   = GameObject.FindGameObjectWithTag("FinishLine").transform.position;
     targetPos.x = gameObject.transform.position.x;
     navMeshRef  = gameObject.GetComponent <NavMeshAgent>();
     rb          = gameObject.GetComponent <Rigidbody>();
 }
    void Start()
    {
        HealthCount = this.GetComponent <Text>();
        PlayerCharacterController playerCharacterController = GameObject.FindObjectOfType <PlayerCharacterController>();

        DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, PlayerHealthCount>(playerCharacterController, this);

        m_PlayerHealth = playerCharacterController.GetComponent <Health>();
        DebugUtility.HandleErrorIfNullGetComponent <Health, PlayerHealthCount>(m_PlayerHealth, this, playerCharacterController.gameObject);
    }
Exemplo n.º 17
0
 public void GameStart()
 {
     abilityController         = FindObjectOfType <AbilityController>();
     playerCharacterController = FindObjectOfType <PlayerCharacterController>();
     enemyController           = FindObjectOfType <EnemyController>();
     InitCharacter();
     InitEnemy();
     InitTurnList();
     BattleStart();
 }
Exemplo n.º 18
0
    public override void Run(List <AbilityTarget> targets)
    {
        Debug.Log("Running behaviour");
        foreach (AbilityTarget target in targets)
        {
            PlayerCharacterController character = target.abilityTarget.GetComponent <PlayerCharacterController>();

            character.AddVelocity(Random.onUnitSphere * 20f);
        }
    }
Exemplo n.º 19
0
    void Start()
    {
        PlayerCharacterController playerCharacterController = GameObject.FindObjectOfType <PlayerCharacterController>();

        DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, FollowPlayer>(playerCharacterController, this);

        m_PlayerTransform = playerCharacterController.transform;

        m_OriginalOffset = transform.position - m_PlayerTransform.position;
    }
Exemplo n.º 20
0
    private void Start()
    {
        m_PlayerCharacterController = GetComponent <PlayerCharacterController>();
        // DebugUtility.HandleErrorIfNullGetComponent<PlayerCharacterController, PlayerInputHandler>(m_PlayerCharacterController, this, gameObject);
        m_GameFlowManager = FindObjectOfType <GameFlowManager>();
        // DebugUtility.HandleErrorIfNullFindObject<GameFlowManager, PlayerInputHandler>(m_GameFlowManager, this);

        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible   = false;
    }
 void OnPicked(PlayerCharacterController player)
 {
     if (player && !player.starIsOn)
     {
         player.starIsOn  = true;
         player.starTimer = timerLength;
         player.audioSource.PlayOneShot(player.starMusic);
         m_Pickup.PlayPickupFeedback();
         Destroy(gameObject);
     }
 }
Exemplo n.º 22
0
    // Use this for initialization
    void Start()
    {
        playerRotation = new GameObject("_rotation");
        cameraRotation = new GameObject("_CamRotation");
        player         = GameObject.Find("Player").GetComponent <PlayerCharacterController>();
//		upVector = player.transform.up;
//		forwardVector  = player.transform.forward;
        offset = player.transform.position +
                 upVector * (distanceUp) -
                 forwardVector * (distanceAway);
    }
Exemplo n.º 23
0
    // Start is called before the first frame update
    void Start()
    {
        int iBonusTypeCount = System.Enum.GetValues(typeof(EBonusType)).Length;

        m_abCurrentBonuses   = new bool[iBonusTypeCount];
        m_afCurrentBonusesDt = new float[iBonusTypeCount];
        m_aCurrentBonuses    = new Bonus[iBonusTypeCount];

        m_character = GetComponent <PlayerCharacterController>();
        Assert.IsNotNull(m_character);
    }
Exemplo n.º 24
0
    void OnPick(PlayerCharacterController p)
    {
        Ammo PlayerAmmo = p.GetComponent <Ammo>();

        if (PlayerAmmo)
        {
            PlayerAmmo.AddAmmo();
            pickup.PlayPickupFeedback();
            Destroy(gameObject);
        }
    }
 private bool CheckObjectStatus(PlayerCharacterController pcc)
 {
     if (isRequireObject)
     {
         return(pcc.currPlayerObjectStatus[requiredObject]);
     }
     else
     {
         return(true);
     }
 }
 // Start is called before the first frame update
 void Awake()
 {
     if (player == null)
     {
         player = FindObjectOfType <PlayerCharacterController>();
         if (player == null)
         {
             player = Instantiate(playerPrefab, transform.position, transform.rotation).GetComponentInChildren <PlayerCharacterController>();
         }
     }
 }
Exemplo n.º 27
0
 void Update()
 {
     if (PlayerGO == null)
     {
         PlayerGO = GameObject.FindWithTag("Player");
         movement = PlayerGO.GetComponent <PlayerCharacterController>();
     }
     // Debug.Log("x: " + movement.movementVector.x+ " y: " + movement.movementVector.y);
     moveX = movement.movementVector.x;
     moveY = movement.movementVector.y;
 }
    public void HandleGameStart(float time)
    {
        _isPlaying     = true;
        gameIsEnding   = false;
        currentRound   = 0;
        _gameStartTime = Time.time;
        _gameEndTime   = 0;
        _roundOngoing  = true;
        //set roundendtime to curr time so that first round is started after timebetweenrounds seconds
        _roundEndTime = Time.time;
        difficulty    = 0;

        if (!m_Player)
        {
            m_Player = FindObjectOfType <PlayerCharacterController>();
            DebugUtility.HandleErrorIfNullFindObject <PlayerCharacterController, GameFlowManager>(m_Player, this);
        }
        // if(!_towerDirector)
        // {
        //     _towerDirector = GameObject.Find("Tower Director").GetComponent<Director>();
        //     if(!_towerDirector)
        //         Debug.LogWarning("[GameFlowManager] Could not find tower director");
        // }
        // if(!_golemDirector)
        // {
        //     _golemDirector = GameObject.Find("Golem Director").GetComponent<Director>();
        //     if(!_golemDirector)
        //         Debug.LogWarning("[GameFlowManager] Could not find golem director");
        // }
        if (!_smallEnemyDirector)
        {
            _smallEnemyDirector = GameObject.Find("Small Enemy Director").GetComponent <Director>();
            if (!_smallEnemyDirector)
            {
                Debug.LogWarning("[GameFlowManager] Could not find Small Enemy director");
            }
            _smallEnemyDirector.canGenerateCredits = true;
        }
        if (!_bigEnemyDirector)
        {
            _bigEnemyDirector = GameObject.Find("Big Enemy Director").GetComponent <Director>();
            if (!_bigEnemyDirector)
            {
                Debug.LogWarning("[GameFlowManager] Could not find Big Enemy director");
            }
            _bigEnemyDirector.canGenerateCredits = true;
        }
        // if(!_chestDirector)
        // {
        //     _chestDirector = GameObject.Find("Chest Director").GetComponent<Director>();
        //     if(!_chestDirector)
        //         Debug.LogWarning("[GameFlowManager] Could not find chest director");
        // }
    }
Exemplo n.º 29
0
 public override void Interact(PlayerCharacterController pc)
 {
     if (!IsLocked())
     {
         Open(!m_Open);
     }
     else
     {
         Unlock();
     }
 }
Exemplo n.º 30
0
 public override void Interact(PlayerCharacterController pc)
 {
     if (!m_isReading)
     {
         StartReading(pc);
     }
     else
     {
         StopReading();
     }
 }
Exemplo n.º 31
0
 public static void SaveData(PlayerCharacterController player)
 {
     PlayerPrefs.SetFloat("playerLevel", player.playerStats.Level);
     PlayerPrefs.SetFloat("playerHP", player.playerStats.Health);
     PlayerPrefs.SetFloat("playerStamina", player.playerStats.Stamina);
     PlayerPrefs.SetFloat("playerPunch", player.playerStats.Punch);
     PlayerPrefs.SetFloat("playerBlaster", player.playerStats.Blaster);
     PlayerPrefs.SetFloat("playerWalkingSpeed", player.playerStats.WalkingSpeed);
     PlayerPrefs.SetFloat("playerRunningSpeed", player.playerStats.RunningSpeed);
     PlayerPrefs.SetFloat("playerExperience", player.playerStats.Experience);
 }
Exemplo n.º 32
0
 void Awake()
 {
     if (m_Character == null && Root.Instance != null)
     {
         m_Character = Root.Instance.m_Character;
     }
 }
 public override void Awake()
 {
     base.Awake();
     _controller = GetComponent<PlayerCharacterController>();
 }
 private void Awake()
 {
     // Get referenes, the SLOW way
     m_CharacterController = GetComponent<PlayerCharacterController>();
 }
Exemplo n.º 35
0
    void Awake()
    {
        foreach (Transform t in m_Cameras)
        {
            m_LocalStartingPositions.Add(t.localPosition);
        }

        if (Root.Instance != null)
        {
            m_Character = Root.Instance.m_Character;
            m_Character.GetComponentInChildren<GenerateParticles>().m_CameraScript = this;
        }

        m_LocalStartingPoint = transform.localPosition;
        m_Direction = Vector3.zero;
        m_BackPlane = false;
        m_CharacterBack = false;
        m_BlockUpdate = false;
        m_SwapPosition = Root.Instance.m_Character.gameObject.GetComponentInChildren<GenerateParticles>().transform;
        m_ResetPosition = m_SwapPosition.localPosition;
        m_Character.m_Overlay = m_Overlay;

        if (m_CameraPaths.Capacity > 0)
        {
            m_ActivePath = m_CameraPaths[0];

            LoadNodes();
        }
    }