void Awake()
    {
        myRb = gameObject.GetComponent <Rigidbody>();

        cameraCtrl = GetComponent <CameraController>();

        slideMgmt = GetComponent <SlideManager>();
        //slideMgmt.enabled = true;

        inputMgmt = gameObject.GetComponent <InputManager>();
        //inputMgmt.enabled = true;

        playerMovement = gameObject.GetComponent <PlayerMovement>();
        //playerMovement.enabled = true;

        weaponMgmt = gameObject.GetComponent <WeaponManager>();
        //weaponMgmt.enabled = true;

        playerStats = gameObject.GetComponent <PlayerStats>();
        //playerStats.enabled = true;

        animMgmt = gameObject.GetComponent <AnimationManager>();
        //animMgmt.enabled = true;

        combatMgmt = gameObject.GetComponent <PlayerCombatManager>();
        //combatMgmt.enabled = true;

        dodgeCtrl = gameObject.GetComponent <DodgeControl>();
        //dodgeCtrl.enabled = true;

        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;
    }
    void OnLevelWasLoaded(int level)
    {
        enemySpawnPoint = GameObject.Find("SpawnPoint2").GetComponent<Transform>();
        if (GameObject.Find(spawnPointName) != null)
        {
            spawnPoint = GameObject.Find(spawnPointName).GetComponent<Transform>();
        }
        else
        {
            spawnPoint = GameObject.Find("SpawnPoint").GetComponent<Transform>();
        }
        if (PhotonNetwork.isMasterClient)
        {
            //PhotonNetwork.InstantiateSceneObject("Orc", enemySpawnPoint.position, enemySpawnPoint.rotation, 0, null);
        }
        player = PhotonNetwork.Instantiate("Elf", spawnPoint.position, spawnPoint.rotation, 0);
        combatManager = player.GetComponent<PlayerCombatManager>();
        combatManager.enabled = true;
        playerRunes = player.GetComponent<Runes>();
        playerRunes.enabled = true;
        //player.GetComponent<Health>().enabled = true;
        cameraFollow = Camera.main.GetComponent<CameraFollow>();
        cameraFollow.enabled = true;
        playerHealth = player.GetComponent<Health>();
        //playerHealth.enabled = true;

    }
Exemplo n.º 3
0
 /// <summary>
 /// Author: Denis
 /// Caching components
 /// </summary>
 private void Start()
 {
     PlayerPullDash    = gameObject.GetComponent <PullDash>();
     PlayerJump        = gameObject.GetComponent <Jump>();
     PlayerCombat      = gameObject.GetComponent <PlayerCombatManager>();
     PlayerKnockback   = gameObject.GetComponent <Knockback>();
     PlayerMultiplayer = gameObject.GetComponent <MultiplayerActivator>();
 }
    public void Update()
    {
        //Instantiates the inital menu
        // Checking To see if the i key is down
        if (Input.GetKeyDown("i"))
        {
            //if the menuscreen is 0 then it is empty if its empty then
            if (m_MenuScreens.Count == 0)
            {
                m_GameManager.CurrentGameState = GameState.Menu;
                Services.GameManager.SetCursorVisibility(true);
                //Add the menu screen to the list
                m_MenuScreens.Add(Instantiate <GameObject>(m_PrefabCanvasDebugMenu));


                m_Player = Services.GameManager.Player;

                m_PlayerCombatManager = GameObject.Find("Player").GetComponent <PlayerCombatManager>();

                if (m_Player != null)
                {
                    //Instantiate the button ontop of the last instantiated canvas
                    DebugButton Debugbutton1 = Instantiate <DebugButton>(m_Prefab_DebugButton, m_MenuScreens[0].gameObject.transform);
                    //Setting the position of the instantiated button
                    Debugbutton1.gameObject.transform.localPosition = new Vector3(170, 100, 0);
                    //Setting the initalization method
                    Debugbutton1.Init("Player Ui", this, DebugButton.DebugButtonType.DebugMenutype, SpawnPlayerCanvas);
                }
            }
        }

        //TODO: Switch button To something else
        // Destroys the whole Debugmenu setup
        if (Input.GetKeyDown("o"))
        {
            Services.GameManager.SetCursorVisibility(false);
            m_GameManager.CurrentGameState = GameState.Playing;
            for (int i = m_MenuScreens.Count; i > 0; i--)
            {
                Destroy(m_MenuScreens[0]);
                m_MenuScreens.RemoveAt(0);
            }
        }

        //TODO: Switch button to something else
        //Pops the top most part of the debugmenu setup
        if (Input.GetKeyDown("p"))
        {
            Destroy(m_MenuScreens[m_MenuScreens.Count - 1]);
            m_MenuScreens.RemoveAt(m_MenuScreens.Count - 1);
            if (m_MenuScreens.Count == 0)
            {
                m_GameManager.CurrentGameState = GameState.Playing;
            }
        }
    }
Exemplo n.º 5
0
 /// <summary>
 /// Author: Denis
 /// Caching components
 /// </summary>
 private void Start()
 {
     CombatManager     = gameObject.GetComponent <PlayerCombatManager>();
     PlayerJump        = gameObject.GetComponent <Jump>();
     PlayerRotation    = gameObject.GetComponent <Rotation>();
     PlayerMultiplayer = gameObject.GetComponent <MultiplayerActivator>();
     WasHit            = false;
     IsKnockback       = false;
     TookOff           = false;
     IsImmune          = false;
 }
Exemplo n.º 6
0
 private void OnTriggerStay(Collider other)
 {
     if (IsAttacking)
     {
         PlayerCombatManager _playerCombatManager = other.gameObject.GetComponent <PlayerCombatManager>();
         if (_playerCombatManager != null && CurrentAttackMotion != null)
         {
             // calculate regular attack
             Vector3 _AttackVector = this.transform.forward.normalized * CurrentAttackMotion.Force;
             //Debug.Log("Attacked with " + _AttackVector);
             _playerCombatManager.ReceivePlayerAttack(_AttackVector, CurrentAttackMotion.KnockBackTime);
             StopAttack();
             if (AudioController != null)
             {
                 AudioController.TriggerPlaySFXOnAll((int)EnemySFX.SLAP);
             }
         }
     }
 }
Exemplo n.º 7
0
    public void Smash()
    {
        //Debug.Log("ExplosionForceApplied");

        Collider[] colliders = Physics.OverlapSphere(transform.position, SmashRadius);

        foreach (Collider _nearby in colliders)
        {
            //Debug.Log("grabbed nearby colliders");
            GameObject          _nearbyObjects       = _nearby.gameObject;
            PlayerCombatManager _playerCombatManager = _nearbyObjects.GetComponent <PlayerCombatManager>();
            if (_playerCombatManager != null)
            {
                //Debug.Log("applying smash to player" + _playerCombatManager.gameObject);
                _playerCombatManager.ReceivePlayerSmash(DefaultSmashTime,
                                                        DefaultSmashForce,
                                                        this.transform.position,
                                                        SmashRadius);
            }
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// Author: Feiyang Li
    /// integrating with combat system
    /// </summary>
    private void OnTriggerStay(Collider Other)
    {
        if (Other.gameObject.tag == "Player" && PhontonView.IsMine)
        {
            if (PhotonNetwork.IsMasterClient)
            {
                PhotonNetwork.Destroy(this.gameObject);
            }

            PlayerCombatManager _playerCombatManager = Other.gameObject.GetComponent <PlayerCombatManager>();
            if (_playerCombatManager != null)
            {
                Vector3 _AttackVector = (Other.transform.position - this.transform.position).normalized * Force;
                _playerCombatManager.ReceivePlayerAttack(Forward * Force + UpwardsAdjustmentVector, BulletAttackTimeSpan);
            }
        }
        else if (Other.gameObject.tag == "Obstacle")
        {
            if (PhotonNetwork.IsMasterClient)
            {
                PhotonNetwork.Destroy(this.gameObject);
            }
        }
    }
Exemplo n.º 9
0
 private void Start()
 {
     combatManager = GetComponentInParent <CombatManager>();
     pcm           = GetComponentInParent <PlayerCombatManager>();
 }