コード例 #1
0
 private void Awake()
 {
     m_characterControllerReference = GetComponent <CharacterController>();
     m_currentState             = ECharacterState.Moving;
     m_digitalJoystickReference = FindObjectOfType <DigitalJoystick>();
     m_joyButtonReference       = FindObjectOfType <JoyButton>();
     m_animator          = GetComponentInChildren <Animator>();
     m_taggingIdentifier = GetComponent <TaggingIdentifier>();
 }
コード例 #2
0
 private void Awake()
 {
     m_animator = GetComponentInChildren <Animator>();
     m_powerUpBoxesInDistance = new List <PowerUpBox>();
     m_navMeshAgent           = GetComponent <NavMeshAgent>();
     m_rigibody             = GetComponent <Rigidbody>();
     m_taggingIdentifier    = GetComponent <TaggingIdentifier>();
     m_powerUpTracker       = GetComponent <PowerUpTracker>();
     m_rigibody.isKinematic = true;
 }
コード例 #3
0
    /// <summary>
    /// <para>Set the first player as tag, use this to initialize the game</para>
    /// </summary>
    public void StartTagging()
    {
        // TODO Select a Random one to start as tag
        TaggingIdentifier initialTagger = m_playersIdentifiers[Random.Range(0, m_playersIdentifiers.Count)];

        // TaggingIdentifier initialTagger = GameObject.FindGameObjectWithTag("Player").GetComponent<TaggingIdentifier>();

        PlayerWasTagged(initialTagger);
        foreach (TaggingIdentifier notItPlayer in GetAllPlayersThatAreNotIt())
        {
            notItPlayer.SetAsNotKing();
        }
    }
コード例 #4
0
    /// <summary>
    /// <para>Communicates to the Tagging Manager a specific player was tagged.</para>
    /// </summary>
    /// <param name="_whoIsTag">Player that was tagged.</param>
    /// <param name="_knockbackEffect">Knockback players or not.</param>
    public void PlayerWasTagged(TaggingIdentifier _whoIsTag, bool _knockbackEffect = false)
    {
        m_currentPlayerTaggingID = _whoIsTag.PlayerIdentifier;
        _whoIsTag.SetAsKing();
        OnPlayerWasTagged?.Invoke(_whoIsTag);

        if (m_UIManager)
        {
            m_UIManager.ShowPlayerTaggedText(_whoIsTag.PlayerName, knockbackDelayTime);
        }

        if (_knockbackEffect)
        {
            // TODO not have / 4.0f on the knockbackDelayTime
            StartCoroutine(KnockbackAllPlayerRoutine(knockbackDelayTime / 4.0f));
        }
    }
コード例 #5
0
        private void Start()
        {
            m_playerTaggingIdentifier = GetComponent <TaggingIdentifier>();
            m_taggingManager          = FindObjectOfType <TaggingManager>();
            m_boppableInterface       = GetComponent <IBoppable>();
            m_UIManager = FindObjectOfType <UIManager>();

            if (this.tag == "Player")
            {
                m_isPlayer = true;
            }

            if (m_isPlayer)
            {
                m_UIManager.UpdatePowerUpUI(slot1, slot2);
            }

            superSpeedTrail.SetActive(false);
        }
コード例 #6
0
 /// <summary>
 /// Update who the Character Controller identifies as Who Is Tag
 /// </summary>
 /// <param name="_identifier">Player who is currently tag</param>
 public void UpdateWhoIsTag(TaggingIdentifier _identifier)
 {
     m_boppableInterface.UpdateWhoIsTag(_identifier.transform);
 }
コード例 #7
0
    private void TriggerAttackTransition(float _attackSizeMultiplier = 1.0f)
    {
        if (GameController.instance)
        {
            PausedMenuManager._instance?.PlaySFX(GameController.instance.blobAttackSounds[Random.Range(0, GameController.instance.blobAttackSounds.Length)]);
        }

        if (GameController.instance && GameController.instance.blobAttackParticle)
        {
            Instantiate(GameController.instance.blobAttackParticle, hammerBopAim.transform.position, GameController.instance.blobAttackParticle.transform.rotation).Play();
        }

        m_boppableInterface.TriggerAttackTransition();

        if (GameController.instance && GameController.instance.attackDecal)
        {
            Instantiate(GameController.instance.attackDecal, new Vector3(hammerBopAim.transform.position.x, 0.05f, hammerBopAim.transform.position.z), GameController.instance.attackDecal.transform.rotation);
        }

        ETaggingBehavior currentTaggingState = m_currentTaggingState;

        m_currentTaggingState = ETaggingBehavior.TaggingAtacking;

        Collider[] bopCollision = Physics.OverlapSphere(hammerBopAim.position, km_attackRadius * _attackSizeMultiplier, attackLayer);
        if (bopCollision.Length > 0)
        {
            for (int i = 0; i < bopCollision.Length; i++)
            {
                TaggingIdentifier playerHitted = bopCollision[i].transform.gameObject.GetComponent <TaggingIdentifier>();
                if (playerHitted != null && playerHitted.CanBeTagged && m_playerIdentifier != playerHitted.PlayerIdentifier)
                {
                    // We hit someone, so we bopped them!

                    if (GameController.instance)
                    {
                        PausedMenuManager._instance?.PlaySFX(GameController.instance.blobHitSounds[Random.Range(0, GameController.instance.blobHitSounds.Length)]);
                    }

                    m_playersBopped++;

                    if (taggingManager.WhoIsKing == playerHitted.PlayerIdentifier)
                    {
                        taggingManager.PlayerWasTagged(this, true);
                        playerHitted.SetAsNotKing();

                        // Updating tagging state because we are tag now.
                        currentTaggingState = m_currentTaggingState;
                    }
                    else
                    {
                        // Just Knockback the Player
                        // TODO Delay here is a magic number
                        // TODO knockback force is also a magic number
                        playerHitted.KnockbackPlayer(Color.magenta, (playerHitted.transform.position - transform.position).normalized * taggingManager.knockbackForce * 3f, 0.5f);
                    }

                    // We break from the loop if we are not using super slam
                    if (_attackSizeMultiplier == 1.0f)
                    {
                        break;
                    }
                }
            }
        }

        StartCoroutine(AttackAnimationRoutine(currentTaggingState));
    }