コード例 #1
0
            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);
                }
            }
コード例 #2
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     // Store the collider point
     contactPoint = hit.point;
 }
コード例 #3
0
 /// <summary>OnControllerColliderHit is called when the controller hits a collider while performing a Move.</summary>
 public virtual void OnControllerColliderHit(ControllerColliderHit hit)
 {
 }
コード例 #4
0
 // Store point that we're in contact with for use in FixedUpdate if needed
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     contactPoint = hit.point;
 }
コード例 #5
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     collisionPoint = hit.point;
     collisionPoint = collisionPoint - transform.position;
 }
コード例 #6
0
ファイル: Bullet.cs プロジェクト: totallyRonja/neon-overdrive
    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();
        }
    }
コード例 #7
0
 public void OnControllerColliderHit(ControllerColliderHit hit)
 {
     Entity?.OnCollisionEnter(hit.gameObject);
 }
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     EventBus.Trigger(EventHooks.OnControllerColliderHit, gameObject, hit);
 }
コード例 #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;
 }
コード例 #10
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     CheckAttackTarget(hit);
 }
コード例 #11
0
ファイル: Player.cs プロジェクト: TheWarriorPoet/Pirate-Life
    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;
        }
    }
コード例 #12
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
 }
コード例 #13
0
 //The part which determines if the controller was hit or not
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     hitNormal = hit.normal;
 }
コード例 #14
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     stellaActionScriptableObjects[(int)NowAction]?.OnControllerColliderHit(hit);
 }
コード例 #15
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     m_Capsule.UF_OnCollisionHit(hit);
 }
コード例 #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;
            }
        }
    }
コード例 #17
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     _contact = hit;
 }
コード例 #18
0
ファイル: PlayerMovement.cs プロジェクト: nickworks/255-LD
 void OnControllerColliderHit(ControllerColliderHit hit) //this is used to detect the slope angle of the floor
 {
     slopeAngle = Vector3.Angle(Vector3.up, hit.normal);
 }
コード例 #19
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     JSMgr.vCall.CallJSFunctionValue(jsObjID, idOnControllerColliderHit, hit);
 }
コード例 #20
0
	void OnControllerColliderHit (ControllerColliderHit hit){
		if (hit.gameObject.tag == "Player"){
			print ("start deformation on camera");
		}
	}
コード例 #21
0
ファイル: Mecha.cs プロジェクト: drack00/Unnamed-Mech-Project
 private void Bounce(ControllerColliderHit hit)
 {
     status |= Status.Prone;
     force  += Vector3.Reflect(hit.moveDirection, hit.normal) * hit.moveLength * forceFalloff;
 }
コード例 #22
0
ファイル: PlayerSelection.cs プロジェクト: alexismorin/rooms
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     hit.gameObject.SendMessage("Bash", GetComponent <Player>(), SendMessageOptions.DontRequireReceiver);
 }
コード例 #23
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     onControllerColliderHit?.Invoke(hit);
 }
コード例 #24
0
ファイル: LuaComponent.cs プロジェクト: Zachary625/TestLua
 public void OnControllerColliderHit(ControllerColliderHit hit)
 {
     CallMethod("OnControllerColliderHit", hit);
 }
コード例 #25
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     normalForce = hit.normal;
 }
コード例 #26
0
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     hitNormal   = hit.normal;
     groundAngle = Vector3.Angle(hitNormal, Vector3.up);
     hitPoint    = hit.point;
 }
コード例 #27
0
 // Store point that we're in contact with for use in FixedUpdate if needed
 private void OnControllerColliderHit(ControllerColliderHit hit)
 {
     m_ContactPoint = hit.point;
 }
コード例 #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;
    }
コード例 #29
0
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     callIfExist(idOnControllerColliderHit, hit);
 }
コード例 #30
0
 protected override void OnOtherCollision(ControllerColliderHit hit)
 {
     touchedWall = true;
     wallNormal  = hit.normal;
 }
コード例 #31
0
            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;
                }
            }
コード例 #32
0
 public virtual void DoControllerColliderHit(ControllerColliderHit collider)
 {
 }