Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            Debug.Log(m_Rigidbody.velocity.magnitude);
            if (m_Rigidbody.velocity.magnitude > 0 && m_ThrownBy != null && m_ThrownBy != other.gameObject && m_IsThrown)
            {
                Scr_PlayerStateController state = m_ThrownBy.GetComponent <Scr_PlayerStateController>();
                if (!state.IsMomInRoom)
                {
                    Scr_ScoreManager.UpdateScore(m_ThrownBy, 500);
                }
                else
                {
                    Scr_ScoreManager.UpdateScore(m_ThrownBy, -50);
                }

                Vector3 dir = transform.forward + transform.up;
                other.gameObject.GetComponent <Scr_CharacterController>().AddImpact(dir, 250.0f);
                other.gameObject.GetComponent <Scr_Combat>().SetHitBy(gameObject);
                m_IsThrown = false;

                //gameObject.SetActive(false);
                Scr_AudioManager.SetRandomPitch("ObjectBreak");
                Scr_AudioManager.Play("ObjectBreak");
            }
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        m_PunchHitBox.SetActive(false);

        m_AnimationController = GetComponent <Scr_AnimationController>();
        m_PlayerState         = GetComponent <Scr_PlayerStateController>();
        m_Input = GetComponent <Scr_Input>();
    }
    private void Awake()
    {
        m_OriginalPunchingPower = gameObject.GetComponent <Scr_Combat>().GetPunchingPower();
        m_OriginalSpeed         = gameObject.GetComponent <Scr_CharacterController>().GetSpeed();
        m_OriginalNrOfMaxJumps  = gameObject.GetComponent <Scr_CharacterController>().GetMaxJumps();

        m_OriginalPowerupTimer = m_PowerupTimer;

        m_PlayerState = GetComponent <Scr_PlayerStateController>();
        m_Input       = GetComponent <Scr_Input>();
    }
Ejemplo n.º 4
0
    private void Punch()
    {
        //Punching
        if (Input.GetButtonDown(m_Input.GetFire()))
        {
            GameObject closestPlayer = GetClosestObjectWithTag("Player");
            m_AnimationController.Animate("Punch");

            if (closestPlayer != null)
            {
                Scr_PlayerStateController state = closestPlayer.GetComponent <Scr_PlayerStateController>();
                if (state.PlayerState != Scr_PlayerStateController.State.BabyBox)
                {
                    Vector3 dir = transform.forward + transform.up;
                    closestPlayer.GetComponent <Scr_CharacterController>().AddImpact(dir, m_PunchingPower);
                    closestPlayer.GetComponent <Scr_Combat>().SetHitBy(gameObject);
                    Scr_AudioManager.SetRandomPitch("PlayerPunch");
                    Scr_AudioManager.Play("PlayerPunch");
                    Scr_ScoreManager.UpdateScore(gameObject, 25);
                }
            }
        }
    }