Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        Player playerCollisioned = other.GetComponentInParent <Player>();

        if (playerCollisioned != null && playerCollisioned.CanMove)
        {
            if (m_Rigidbody.velocity != Vector3.zero)
            {
                AudioManager.instance.PlaySFx(AudioManager.instance.audioClips.wagonHit, 1f);
                StartCoroutine(playerCollisioned.Stun(true, 2.2f));

                if (playerCollisioned.transform.position.z > transform.position.z)
                {
                    playerCollisioned.Rigidbody.AddForce(Quaternion.AngleAxis(60, Vector3.right) * Vector3.forward * pushForce, ForceMode.Impulse);
                }
                else
                {
                    playerCollisioned.Rigidbody.AddForce(Quaternion.AngleAxis(60, Vector3.right) * -Vector3.forward * pushForce, ForceMode.Impulse);
                }
            }
        }

        if (GameModeDataBase.IsCurrentFreeForAll())
        {
            if (other.tag == "Wagon")
            {
                AudioManager.instance.PlaySFx(AudioManager.instance.audioClips.rollingWagon, false, 0.7f);
                StartCoroutine(LerpPosition(timeToLerpPosition, transform.position, other.transform.position));
                transform.rotation   = other.transform.rotation;
                m_Rigidbody.velocity = Vector3.zero;
            }
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        if (GameModeDataBase.IsCurrentHotPotato() || GameModeDataBase.IsCurrentFreeForAll())
        {
            if (HotPotatoManager.HotPotato.Bomb.transform.parent == null)
            {
                plane.SetVector("_Target", HotPotatoManager.HotPotato.Bomb.transform.position);
            }
        }

        if (anticipation)
        {
            time += Time.deltaTime;

            for (int i = 0; i < colliders.Length; i++)
            {
                colliders[i].localPosition = Vector3.MoveTowards(colliders[i].localPosition, colliders[i].forward * nRings * 4f, (anticipationTime / 2) * Time.deltaTime);
            }

            for (int i = 0; i < rings[anticipationRing].module.Length; i++)
            {
                rings[anticipationRing].renderers[i].material.color = colorAnticipation.Evaluate(time);
            }

            if (time >= 1)
            {
                AudioManager.instance.PlaySFx(AudioManager.instance.audioClips.anticipation, 0.7f);

                time = 0;
            }
        }
    }
Ejemplo n.º 3
0
    private void Start()
    {
        m_Rigidbody = GetComponent <Rigidbody>();
        if (GameModeDataBase.IsCurrentFreeForAll())
        {
            colliders = GetComponentsInChildren <Collider>();

            foreach (Collider collider in colliders)
            {
                collider.gameObject.transform.parent = null;
            }
        }
    }
Ejemplo n.º 4
0
    private void Winner()
    {
        isEndPanelActive = true;
        m_Animator.SetTrigger("isGameOver");

        if (GameModeDataBase.IsCurrentHotPotato())
        {
            textWinner.text     = string.Format("{0}", GameManager.Manager.Players[0].PrefabName);
            playerSprite.sprite = InGame.playerSettings[GameManager.Manager.Players[0].Id].skinSprite;
        }
        else if (GameModeDataBase.IsCurrentFreeForAll())
        {
            textWinner.text     = string.Format("{0}", InGame.playerSettings[FreeForAllManager.FreeForAll.WinnerID].name);
            playerSprite.sprite = InGame.playerSettings[FreeForAllManager.FreeForAll.WinnerID].skinSprite;
        }
        else if (GameModeDataBase.IsCurrentBasesGame())
        {
        }
    }