예제 #1
0
    public AudioClip pickUpGem;     //the clip to play

    private void Start()
    {
        audioSource  = GetComponent <AudioSource>();               //to play the sound
        spyrosScript = spyro.GetComponent <ThirdPersonMovement>(); //to trigger the floating text
        touchParticles.SetActive(false);
        trailParticle.SetActive(false);
    }
예제 #2
0
 private void Start()
 {
     _player   = GameObject.Find("Player");
     _health   = (Health)_player.GetComponent <Health>();
     _stamina  = (Stamina)_player.GetComponent <Stamina>();
     _movement = (ThirdPersonMovement)_player.GetComponent <ThirdPersonMovement>();
 }
    protected override void Collect(ThirdPersonMovement player)
    {
        _weaponHolder = player.GetComponentInChildren <AbilityHolder>().gameObject;
        AbilitySwap swap = player.GetComponent <AbilitySwap>();

        swap.SwapMainAbility(_abilityToSwapIn, _weaponHolder);
    }
    void Update()
    {
        #region currentspeed

        //Copys currentspeed from ThirdPersonMovement (player).
        GameObject          go = GameObject.Find("Player");
        ThirdPersonMovement sc = go.GetComponent <ThirdPersonMovement>();
        fallingspeed = sc.velocity.y;
        currentspeed = sc.currentspeed;
        anim.SetFloat("currentspeed", currentspeed);
        anim.SetFloat("fallingspeed", fallingspeed);

        #endregion

        #region checkIfGrounded

        //Copys Bool isGrounded from ThirdPersonMovement (player).
        isGrounded = sc.isGrounded;
        anim.SetBool("isGrounded", isGrounded);

        #endregion


        if (Input.GetButtonDown("Jump") && isGrounded)
        {
            anim.Play("BasicMotions@JumpStart01");
        }

        anim.SetBool("isGrounded", isGrounded);
    }
예제 #5
0
 void Awake()
 {
     armRB        = player.gameObject.GetComponent <Rigidbody>();
     lineRenderer = GetComponent <LineRenderer>();
     TPM          = FindObjectOfType <ThirdPersonMovement>();
     cam          = FindObjectOfType <Camera>().transform;
 }
예제 #6
0
    // Start is called before the first frame update
    void Start()
    {
        _controller  = GetComponent <CharacterController>();
        _animator    = GetComponent <Animator>();
        _thirdPerson = GetComponent <ThirdPersonMovement>();

        _controls.Player.Jump.performed += OnJump;
    }
예제 #7
0
    void Start()
    {
        animator            = GetComponent <Animator>();
        thirdPersonMovement = GetComponentInParent <ThirdPersonMovement>();

        animatorOverrideController = new AnimatorOverrideController();
        animatorOverrideController.runtimeAnimatorController = animator.runtimeAnimatorController;
    }
예제 #8
0
 /// <summary>
 /// the code that runs upon initialization of the state
 /// </summary>
 /// <param name="controller"></param>
 public override void OnBegin(ThirdPersonMovement controller)
 {
     base.OnBegin(controller);
     damageMult = 1;
     mat        = controller.GetComponent <Renderer>().material;
     mat.color  = Color.white;
     shield     = controller.shield;
 }
예제 #9
0
 public static bool ActiveIK(ThirdPersonAction action, ThirdPersonPosture posture,
                             ThirdPersonPosture nextPosture, ThirdPersonMovement movement)
 {
     return(action == ThirdPersonAction.EndOfTheWorld &&
            !IKFilter.IsInThirdPersonPostureFilters(posture) &&
            !IKFilter.IsInThirdPersonPostureFilters(nextPosture) &&
            movement != ThirdPersonMovement.Sprint);
 }
예제 #10
0
    private void PassBallToPlayer(ThirdPersonMovement targetPlayer)
    {
        var direction = DirectionTo(targetPlayer);

        ball.transform.SetParent(null);
        ball.GetComponent <Rigidbody>().isKinematic = false;
        ball.GetComponent <Rigidbody>().AddForce(direction * passForce);
    }
예제 #11
0
 private void Awake()
 {
     if (_startingAbility != null)
     {
         _abilityLoadout?.EquipAbility(_startingAbility);
     }
     _thirdPersonMovement = GetComponent <ThirdPersonMovement>();
     _audioSource         = GetComponent <AudioSource>();
 }
 // Start is called before the first frame update
 void Start()
 {
     //int count = attackStringOne.Count;
     if (Player != null)
     {
         playerScriptReference = Player.GetComponent <ThirdPersonMovement>();
         playerAnimator        = Player.GetComponent <Animator>();
     }
 }
예제 #13
0
    private void OnTriggerExit(Collider other)
    {
        ThirdPersonMovement player = other.GetComponent <ThirdPersonMovement>();

        if (player)
        {
            player.speed += slowDown;
        }
    }
예제 #14
0
 void Start()
 {
     enemyManager   = FindObjectOfType <EnemyManager>();
     animator       = GetComponent <Animator>();
     enemyDetection = GetComponentInChildren <EnemyDetection>();
     //movementInput = GetComponent<MovementInput>();
     movementInput = GetComponent <ThirdPersonMovement>();
     impulseSource = GetComponentInChildren <CinemachineImpulseSource>();
 }
예제 #15
0
 /// <summary>
 /// the code that runs upon initialization of the state
 /// </summary>
 /// <param name="controller"></param>
 public override void OnBegin(ThirdPersonMovement controller)
 {
     base.OnBegin(controller);
     damageMult            = 1.2f;
     mat                   = controller.GetComponent <Renderer>().material;
     mat.color             = Color.blue;
     controller.lastAction = 0;
     shield                = controller.shield;
 }
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
예제 #17
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         ThirdPersonMovement player = other.GetComponent <ThirdPersonMovement>();
         if (player)
         {
             player.speed -= slowDown;
         }
     }
 }
예제 #18
0
    public void StartCombat()
    {
        pmove = PM.playerMove;
        pload = PM.playerload;

        //load all weps
        pload.FirstLoad(Prim, Seco, Util, Move);

        //TEMP: LOAD PRIM'S ACTION; DO IT in playerloadout FOR REST LATER.
        Prim.ActionSlot = playerInput.MovementMK.Primary;
    }
예제 #19
0
 /// <summary>
 /// the code that runs upon initialization of the state
 /// </summary>
 /// <param name="controller"></param>
 public override void OnBegin(ThirdPersonMovement controller)
 {
     base.OnBegin(controller);
     damageMult = 1.1f;
     mat        = controller.GetComponent <Renderer>().material;
     mat.color  = Color.yellow;
     sword      = controller.sword;
     sword.transform.localEulerAngles = new Vector3(0, currentAttackAngle, 0);
     sword.SetActive(true);
     controller.lastAction = 0;
     controller.stamina   -= 10;
 }
예제 #20
0
 // Start is called before the first frame update
 void Start()
 {
     speed          = GetComponent <Speed>();
     playerMovement = GetComponent <ThirdPersonMovement>();
     bodyCombinations.Add(defaultBody);
     bodyCombinations.Add(swordBody);
     bodyCombinations.Add(axeBody);
     bodyCombinations.Add(scytheBody);
     bodyCombinations.Add(legsBody);
     bodyCombinations.Add(projectileBody);
     animManager = GetComponent <AnimationManager>();
 }
예제 #21
0
    /// <summary>
    /// the code that runs upon initialization of the state
    /// </summary>
    /// <param name="controller"></param>
    public override void OnBegin(ThirdPersonMovement controller)
    {
        damageMult = 0;
        base.OnBegin(controller);
        controller.lastAction = 0;

        dodgeStart          = controller.transform.position;
        dodgeEnd            = dodgeStart + controller.currentVelocity.normalized * dodgeDistance;
        mats                = controller.GetComponent <Renderer>().material;
        mats.color          = Color.green;
        controller.stamina -= 20;
    }
예제 #22
0
    private void OnTriggerEnter(Collider other)
    {
        ThirdPersonMovement player = other.GetComponent <ThirdPersonMovement>();

        if (player != null)
        {
            Collect(player);
            //spawn particles/fx beause we need to disable object
            CollectFeedback();
            DisableSelf();
        }
    }
예제 #23
0
    // Start is called before the first frame update
    void Start()
    {
        tabs = new List <Tab>();

        currentChat      = 0;
        manager          = GameObject.FindGameObjectWithTag("Manager").GetComponent <FarPersonManager>();
        playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <ThirdPersonMovement>();
        scrolling        = false;
        messageFinnish   = false;
        ReadChatLists();
        StartChat();
    }
예제 #24
0
        public void OnTransition(State previousState, DaleStateHandler daleStateHandler)
        {
            Animator            animator            = daleStateHandler.animator;
            ThirdPersonMovement thirdPersonMovement = daleStateHandler.thirdPersonMovement;
            GravityHandler      gravityHandler      = daleStateHandler.gravityHandler;

            gravityHandler.Jump();
            Debug.Log("jumping transition");
            animator.SetBool("jump", true);
            animator.SetBool("run", false);
            animator.SetBool("movingBackward", false);
            thirdPersonMovement.enabled = false;
        }
예제 #25
0
    private void OnTriggerEnter(Collider other)
    {
        IDamageable <int> damageable = other.GetComponent <IDamageable <int> >();

        if (damageable != null)
        {
            damageable.Damage(_damageAmount);
            ThirdPersonMovement playerMove = other.GetComponent <ThirdPersonMovement>();
            if (playerMove != null)
            {
                playerMove.Knockback(gameObject.transform.position, _knockbackForce);
            }
        }
    }
예제 #26
0
    private void OnTriggerEnter(Collider other)
    {
        switch (gameObject.tag)
        {
        default:
            break;
        }
        //https://answers.unity.com/questions/50279/check-if-layer-is-in-layermask.html
        if (Target == (Target | (1 << other.gameObject.layer)))
        {
            print("Collided with " + other.gameObject.name + "Layer: " + other.gameObject.layer);
            print(Target);

            ThirdPersonMovement playerCharacter = other.transform.GetComponent <ThirdPersonMovement>();
            //TODO: Make this generic. Currently this "Weapon" is setup for a bladeclubber's animations
            if (Wielder.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).IsName("AttackStringI") && hitCounter1 < 1)
            {
                //playerCharacter.AddImpact(transform.forward, 1.0f);
                if (!playerCharacter.GetIframe())
                {
                    playerCharacter.AddImpact(Vector3.zero, 0);
                    print("Knockback 1");
                    hitCounter1++;
                    print("Hit Counter Attack String I: " + hitCounter1);

                    playerCharacter.healthBar.SetHealth(playerCharacter.healthBar.GetHealth() - 2.5f);
                    SpawnCombatVFX(this.transform);
                }
            }
            else if (Wielder.GetComponent <Animator>().GetCurrentAnimatorStateInfo(0).IsName("AttackStringII") && hitCounter2 < 1)
            {
                if (!playerCharacter.GetIframe())
                {
                    playerCharacter.AddImpact(Vector3.up, force);
                    print("Knockback 10");
                    hitCounter2++;
                    print("Hit Counter Attack String II: " + hitCounter2);

                    playerCharacter.healthBar.SetHealth(playerCharacter.healthBar.GetHealth() - 2.5f);
                    SpawnCombatVFX(this.transform);
                }
            }

            /*else
             * {
             *  playerCharacter.AddImpact(transform.forward, force);
             * }*/
        }
    }
예제 #27
0
    void Start()
    {
        particles    = GetComponentInChildren <ParticleSystem>();
        playerHealth = FindObjectOfType <PlayerHealth>();
        TPM          = FindObjectOfType <ThirdPersonMovement>();
        bullet       = transform.GetChild(1);
        vignette     = FindObjectOfType <VignetteAnimate>();

        Vector3 randomOffset = new Vector3(Random.Range(-bulletSpread, bulletSpread), Random.Range(-bulletSpread, bulletSpread), Random.Range(-bulletSpread, bulletSpread));

        particles.Stop();

        transform.LookAt(TPM.transform);
        transform.eulerAngles += randomOffset;
    }
예제 #28
0
    // Update is called once per frame
    void Update()
    {
        //Define position based on a constant x, y , then base final
        float value = this.GetComponent <BoxCollider>().center.z;

        Debug.DrawRay(transform.position, transform.forward * (this.GetComponent <BoxCollider>().center.z + 2f), Color.red);
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit, this.GetComponent <BoxCollider>().center.z + 2f, Player))
        {
            ThirdPersonMovement playerCharacter = hit.transform.GetComponent <ThirdPersonMovement>();
            playerCharacter.AddImpact(transform.forward, force);
            playerCharacter.healthBar.SetHealth(playerCharacter.healthBar.GetHealth() - 10.0f);
        }
    }
예제 #29
0
    //on collision with interactable objects apply a force to those obje
    private void OnTriggerEnter(Collider collision)
    {
        if (collision.gameObject.tag == "Interactable")
        {
            Rigidbody _rb = collision.gameObject.GetComponent <Rigidbody>();

            playerPosition = player.GetComponent <Transform>();
            ThirdPersonMovement playerController = player.GetComponent <ThirdPersonMovement>();

            //calculate the direction of the pushc
            direction = collision.gameObject.transform.position - playerPosition.position;

            _rb.AddForce(collision.gameObject.transform.up.normalized * vPushForce * playerController.currentPushStrength);
            _rb.AddRelativeForce(direction.normalized * hPushForce * playerController.currentPushStrength);
        }
    }
예제 #30
0
    void Start()
    {
        RB           = GetComponent <Rigidbody>();
        hammerWeapon = FindObjectOfType <HammerWeapon>();
        enemy1Script = GetComponentInParent <Enemy1Script>();
        TPM          = FindObjectOfType <ThirdPersonMovement>();
        hips         = TPM.gameObject.GetComponent <Rigidbody>();

        if (SceneManager.GetActiveScene().buildIndex == 0)
        {
            foreach (Rigidbody rb in enemy1Script.rigidbodys)
            {
                rb.isKinematic = false;
            }
        }
    }