示例#1
0
 public void BouncedOn()
 {
     if (!playerWalkMove)
     {
         playerWalkMove = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerWalkMove>();
     }
     if (bounceSound)
     {
         AudioSource.PlayClipAtPoint(bounceSound, transform.position);
     }
     if (playerWalkMove)
     {
         var bounceMultiplier = new Vector3(0f, 1.5f, 0f) * playerWalkMove.onEnemyBounce;
         playerWalkMove.BounceOnEnemy(bounceForce + bounceMultiplier);
     }
 }
    private void Awake()
    {
        Instance = this;

        #region Add Player Script Components
        playerWalkMove = GetComponent <PlayerWalkMove>();
        playerCarMove  = GetComponent <PlayerCarMove>();
        rb             = GetComponent <Rigidbody>();
        inventory      = GetComponent <PlayerInventory>();
        playerGun      = GetComponentInChildren <PlayerGun>();
        playerCollider = GetComponent <CapsuleCollider>();
        #endregion

        playerWalkMove.enabled = true;
        playerCarMove.enabled  = false;
    }