void OnControllerColliderHit(ControllerColliderHit a_collision)
            {
                CollectibleValue collectible = a_collision.collider.GetComponent<CollectibleValue>();

                if(collectible != null  &&  CollectibleValue.m_instances.Contains(collectible))
                {
                    Points componentPoints = GetComponent<Points>();
                    componentPoints.Add(collectible.Points);

                    CollectibleValue.m_instances.Remove(collectible);
                    Destroy(collectible.gameObject);
                }
            }
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     // Store the collider point
     contactPoint = hit.point;
 }
 /// <summary>OnControllerColliderHit is called when the controller hits a collider while performing a Move.</summary>
 public virtual void OnControllerColliderHit(ControllerColliderHit hit)
 {
 }
Exemple #4
0
 // Store point that we're in contact with for use in FixedUpdate if needed
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     contactPoint = hit.point;
 }
Exemple #5
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     collisionPoint = hit.point;
     collisionPoint = collisionPoint - transform.position;
 }
    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        bool hitGround = Vector3.Dot(hit.normal, Vector3.up) > 0.5f;

        //don't collide with the ground
        if (hitGround)
        {
            return;
        }

        if (hit.gameObject.CompareTag("Player"))
        {
            //hitting a player
            Player otherPlayer = hit.gameObject.GetComponent <Player>();
            if (otherPlayer == null)
            {
                Kill();
                return;
            }

            otherPlayer.Hit(damage);
            if (damage > 20)
            {
                Screenshake.current.Shake(0.5f, 0.1f);
            }
            if (size > 2)
            {
                GridDistortion.current.Distort(team.distortionIndex, hit.transform.position, size - 2);
                GridDistortion.current.Expand(team.distortionIndex, (size - 2) * -10, 250);

                if (particles)
                {
                    (Instantiate(particles, hit.transform.position, Quaternion.identity) as HitParticles).InitSystem(team.team, (int)(Mathf.Pow(size, 2.5f) * 2));
                }
            }
            Kill();
        }
        else if (hit.gameObject.CompareTag("Bullet"))
        {
            //hitting another bullet
            Bullet otherBullet = hit.gameObject.GetComponent <Bullet>();
            if (otherBullet == null)
            {
                Kill();
                return;
            }

            if (otherBullet.damage > damage + 0.25f)
            {
                Kill();
            }
            else if (otherBullet.damage < damage - 0.25f)
            {
                otherBullet.Kill();
            }
            else
            {
                otherBullet.Kill();
                Kill();
            }
        }
        else if (hit.gameObject.CompareTag("Bouncy"))
        {
            Vector3 flatnormal = hit.normal;
            flatnormal.y = 0;
            direction    = Vector3.Reflect(direction, flatnormal);

            //tell the bounce object that it was collided with
            Bouncy bounce = hit.gameObject.GetComponent <Bouncy>();
            if (bounce)
            {
                bounce.Bounce();
            }
        }
        else
        {
            Kill();
        }
    }
Exemple #7
0
 public void OnControllerColliderHit(ControllerColliderHit hit)
 {
     Entity?.OnCollisionEnter(hit.gameObject);
 }
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     EventBus.Trigger(EventHooks.OnControllerColliderHit, gameObject, hit);
 }
Exemple #9
0
 // Esta funcion detecta cuando colisinamos con otro objeto mientras nos movemos
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     //Almacenamos la normal del plano contra el que hemos chocado en hitNormal.
     hitNormal = hit.normal;
 }
Exemple #10
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     CheckAttackTarget(hit);
 }
Exemple #11
0
    void OnControllerColliderHit(ControllerColliderHit collision)
    {
        if (_headStarting && collision.gameObject.layer == LayerMask.NameToLayer("Obstacle"))
        {
            disableGOs.Add(collision.gameObject);
            Invoke("DisableGameObject", 0.05f);
        }
        if (sceneManager != null && collision.gameObject.CompareTag("Smashable") && !ragdolled)
        {
            if (playerMode == PlayerMode.CRASHING && !_headStarting)
            {
                return;
            }
            else if (drunkenness >= drunkSmashValue || _headStarting)
            {
                foreach (GameObject go in GetComponentInChildren <NearbyCrates>().CratesAhead)
                {
                    go.SetActive(false);
                }

                AudioSource.PlayClipAtPoint(smackSound, transform.position);
                if (!_headStarting)
                {
                    SoberUp(drunkSmashValue);
                    prevMultiplier = multiplier;
                    multiplier     = 1.0f;
                }
                Instantiate(smashPrefab, transform.position + (transform.forward * 3.0f), transform.rotation);

                playerMode = PlayerMode.CRASHING;
                if (!_headStarting)
                {
                    StartCoroutine("CrateCrashing");
                }
            }
        }

        if (sceneManager != null && collision.gameObject.layer == LayerMask.NameToLayer("Obstacle") && !_headStarting)
        {
            if (collision.gameObject.CompareTag("Smashable") && playerMode == PlayerMode.CRASHING)
            {
                return;
            }

            AudioSource.PlayClipAtPoint(smackSound, transform.position);
            KillCharacter(true);
        }

        if (jumping && !controller.isGrounded && collision.moveDirection.y < 0)
        {
            if (!ragdolled)
            {
                AudioSource.PlayClipAtPoint(landSound, transform.position);
                anim.Play("Falling");
                jumping = false;
            }
        }

        if (collision.moveDirection.y < 0 && !jumping)
        {
            jumpVelocity = -0.1f;
        }
    }
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
 }
Exemple #13
0
 //The part which determines if the controller was hit or not
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     hitNormal = hit.normal;
 }
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     stellaActionScriptableObjects[(int)NowAction]?.OnControllerColliderHit(hit);
 }
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     m_Capsule.UF_OnCollisionHit(hit);
 }
Exemple #16
0
    //when character collides with an object
    private void OnControllerColliderHit(ControllerColliderHit hit)
    {
        if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "Enemy")
        {
            anim.Play("DAMAGED01", -1, 0f);
            Death();
        }

        if (hit.point.z > transform.position.z + 0.1f && hit.gameObject.tag == "Coin")
        {
            //remove the coin from field of play
            Destroy(hit.gameObject);

            //take the letter associated with the coin
            grabLetter = hit.gameObject.GetComponentInChildren <TextMesh>().text.ToString();


            Debug.Log("LastLetterIssued: " + CoinPick.getCurrentLetter() + " CoinLetter " + grabLetter);

            //determine if that letter was correct
            if (grabLetter.Equals(CoinPick.getCurrentLetter()))
            {
                //update the partial word text
                partialWordText.text = null;
                partialWord          = partialWord + grabLetter;
                partialWordText.text = partialWord;
                CoinPick.currentLetterIndex++;

                //give a score boost
                Score.score++;

                //check if word was spelled and then reset CoinPick indexes
                //while maintaining the word index
                if (partialWord.Equals(CoinPick.currentWord))
                {
                    int oldWordIndex = CoinPick.wordArrayIndex;
                    CoinPick.wordEndCount = CoinPick.counter;
                    CoinPick.ResetVars();
                    CoinPick.wordArrayIndex = oldWordIndex + 1;
                    partialWord             = null;

                    //this if statement checks to see how fast a player spelled a word
                    //if fast enough we give them a score bonus
                    if ((CoinPick.wordEndCount - CoinPick.wordStartCount) <= (CoinPick.currentWord.Length + 1))
                    {
                        Score.score = Score.score + 5;
                    }
                }
                //increment letter index and return out of method
                return;
            }
            //end the game if the letter was incorrect
            else if (grabLetter.Equals(null))
            {
                return;
            }
            else
            {
                WrongWordText.text = ("Word spelled incorrectly: " + CoinPick.currentWord);

                Death();
                return;
            }
        }
    }
Exemple #17
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     _contact = hit;
 }
Exemple #18
0
 void OnControllerColliderHit(ControllerColliderHit hit) //this is used to detect the slope angle of the floor
 {
     slopeAngle = Vector3.Angle(Vector3.up, hit.normal);
 }
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     JSMgr.vCall.CallJSFunctionValue(jsObjID, idOnControllerColliderHit, hit);
 }
Exemple #20
0
	void OnControllerColliderHit (ControllerColliderHit hit){
		if (hit.gameObject.tag == "Player"){
			print ("start deformation on camera");
		}
	}
Exemple #21
0
 private void Bounce(ControllerColliderHit hit)
 {
     status |= Status.Prone;
     force  += Vector3.Reflect(hit.moveDirection, hit.normal) * hit.moveLength * forceFalloff;
 }
Exemple #22
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     hit.gameObject.SendMessage("Bash", GetComponent <Player>(), SendMessageOptions.DontRequireReceiver);
 }
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     onControllerColliderHit?.Invoke(hit);
 }
Exemple #24
0
 public void OnControllerColliderHit(ControllerColliderHit hit)
 {
     CallMethod("OnControllerColliderHit", hit);
 }
Exemple #25
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     normalForce = hit.normal;
 }
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     hitNormal   = hit.normal;
     groundAngle = Vector3.Angle(hitNormal, Vector3.up);
     hitPoint    = hit.point;
 }
 // Store point that we're in contact with for use in FixedUpdate if needed
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     m_ContactPoint = hit.point;
 }
Exemple #28
0
    [HideInInspector] public bool isRunning;         // Used when using the keyboard to run, brings the normalised speed to 1

    private void OnControllerColliderHit(ControllerColliderHit hit)
    {
        lastHit = hit;
    }
Exemple #29
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     callIfExist(idOnControllerColliderHit, hit);
 }
 protected override void OnOtherCollision(ControllerColliderHit hit)
 {
     touchedWall = true;
     wallNormal  = hit.normal;
 }
            void OnControllerColliderHit(ControllerColliderHit col)
            {
                // This keeps the player from sticking to walls
                float angle = col.normal.y * 90;

                if (angle < slopeLimit) {
                    if (grounded) {
                        velocity = Vector3.zero;
                    }

                    if (velocity.y > 0) {
                        velocity.y = 0;
                    } else {
                        velocity += new Vector3(col.normal.x, 0, col.normal.z).normalized;
                    }

                    grounded = false;
                } else {
                    grounded = true;
                    velocity.y = 0;
                }
            }
Exemple #32
0
 public virtual void DoControllerColliderHit(ControllerColliderHit collider)
 {
 }