コード例 #1
0
    private IEnumerator SpawnProjectile()
    {
        Debug.Log("Fired");
        if (agentAnimatorManager.Active == false)
        {
            agentAnimatorManager.Active = true;
        }
        yield return(new WaitUntil(() =>
                                   StaticToolMethods.GetAnimatorStateInfo(0, agentAnimatorManager.agentAnimator).IsName("Idle")));

        GameObject target             = new GameObject();
        float      predictionOffesetX = Random.Range(playerRigidBody.velocity.x * -0.2f, playerRigidBody.velocity.x * 0.2f);
        float      predictionOffesetY = Random.Range(playerRigidBody.velocity.y * -0.2f, playerRigidBody.velocity.y * 0.2f);
        float      predictionOffesetZ = Random.Range(playerRigidBody.velocity.z * -0.2f, playerRigidBody.velocity.z * 0.2f);

        Vector3 preditcionOffset = new Vector3(predictionOffesetX, predictionOffesetY, predictionOffesetZ);
        Vector3 midCenterOffset  = new Vector3(0, 0.4f, 0);

        target.transform.position = player.transform.position + midCenterOffset + preditcionOffset;

        positionToSpawn.LookAt(target.transform);

        agentAnimatorManager.PlayAttackAnimation();
        yield return(new WaitForSeconds(0.2f));

        GameObject spawnObject = Instantiate(objectToSpawn, positionToSpawn.position, positionToSpawn.transform.rotation);

        spawnObject.GetComponent <Rigidbody>().AddForce(positionToSpawn.transform.forward * velocityProjectile, ForceMode.Impulse);
        yield return(new WaitUntil(() =>
                                   !StaticToolMethods.GetAnimatorStateInfo(0, agentAnimatorManager.agentAnimator).IsName("Attacking")));

        yield break;
    }
コード例 #2
0
    private IEnumerator Dash()
    {
        if (!StaticToolMethods.GetAnimatorStateInfo(0, playerAnimatorManager.animatorPlayer).IsName("Dashing"))
        {
            playerAnimatorManager.PlayDashAnimation();
        }
        playerParticleSystemManager.PlayDashAnimation();
        playerTideComboManager.StartCombo();
        PlayerResourcesManager.Dashes -= 1;
        dashesImages[(int)PlayerResourcesManager.Dashes].SetActive(false);
        playerPhysicsModule.moveForce  = dashForce;
        playerPhysicsModule.speedLimit = dashLimit;
        playerPhysicsModule.maxInput   = 1f;
        yield return(new WaitForSeconds(0.15f));

        playerPhysicsModule.moveForce = playerPhysicsModule.defaultMoveForce;
        while (playerPhysicsModule.speedLimit > playerPhysicsModule.runLimit + 0.2f)
        {
            playerPhysicsModule.speedLimit
                = Mathf.Lerp(playerPhysicsModule.speedLimit, playerPhysicsModule.runLimit, Time.deltaTime * 10);
            playerPhysicsModule.maxInput = Mathf.Lerp(playerPhysicsModule.maxInput, 0.5f, Time.deltaTime * 5f);
            yield return(new WaitForSeconds(0.03f));
        }
        yield break;
    }
コード例 #3
0
ファイル: Yi.cs プロジェクト: ChaoxinY/ShiftingTide
    private IEnumerator HeadSlam()
    {
        agent.speed = 0;
        attacking   = true;
        yiAgentAnimatorManager.Moving = false;
        yiAgentAnimatorManager.PlayHeadSlamAnimation();
        StartCoroutine(yiHitBoxManager.HeadSlamHitBoxAnimation());
        yield return(new WaitForSeconds(0.6f));

        attacking = false;
        yield return(new WaitUntil(() => !StaticToolMethods.GetAnimatorStateInfo(0, agentAnimatorManager.agentAnimator).IsName("HeadSlam")));

        agent.speed = standardSpeed;
        yiAgentAnimatorManager.Moving = true;
        yield break;
    }
コード例 #4
0
ファイル: StatueBrute.cs プロジェクト: ChaoxinY/ShiftingTide
    private IEnumerator SpearCharge()
    {
        agentAnimatorManager.Moving = false;
        agent.updateRotation        = false;
        agent.updatePosition        = false;
        Rigidbody rigidbodyAgent = GetComponent <Rigidbody>();

        rigidbodyAgent.isKinematic = false;
        rigidbodyAgent.velocity    = Vector3.zero;
        agentAnimatorManager.PlayAttackAnimation();
        StartCoroutine(statueBruteHitBoxManager.SpearChargeHitBoxAnimation());
        yield return(new WaitForSeconds(0.8f));

        charging = true;
        yield return(new WaitUntil(() => !StaticToolMethods.GetAnimatorStateInfo(0, agentAnimatorManager.agentAnimator).IsName("Attacking")));

        rigidbodyAgent.isKinematic = true;
        charging           = false;
        agent.nextPosition = transform.position;
        //agent.enabled = true;
        agent.updatePosition = true;
        agent.updateRotation = true;
    }