示例#1
0
        // Token: 0x06004012 RID: 16402 RVA: 0x0010C5F4 File Offset: 0x0010A7F4
        public override void FixedUpdate()
        {
            this.targetMoveVector = Vector3.ProjectOnPlane(Vector3.SmoothDamp(this.targetMoveVector, base.inputBank.aimDirection, ref this.targetMoveVectorVelocity, ChargeAgu.turnSmoothTime, ChargeAgu.turnSpeed), Vector3.up).normalized;
            base.characterDirection.moveVector = this.targetMoveVector;
            Vector3 forward = base.characterDirection.forward;
            float   value   = this.moveSpeedStat * ChargeAgu.chargeMovementSpeedCoefficient;

            base.characterMotor.moveDirection = forward * ChargeAgu.chargeMovementSpeedCoefficient;
            this.animator.SetFloat("forwardSpeed", value);
            if (base.isAuthority && this.attack.Fire(null))
            {
            }
            if (this.overlapResetStopwatch >= 1f / ChargeAgu.overlapResetFrequency)
            {
                this.overlapResetStopwatch -= 1f / ChargeAgu.overlapResetFrequency;
            }
            if (base.isAuthority && Physics.OverlapSphere(this.sphereCheckTransform.position, ChargeAgu.overlapSphereRadius, LayerIndex.world.mask).Length != 0)
            {
                base.healthComponent.TakeDamageForce(forward * 1f, true, false);
                StunState stunState = new StunState();
                stunState.stunDuration = ChargeAgu.selfStunDuration;
                this.outer.SetNextState(stunState);
                return;
            }
            this.stopwatch             += Time.fixedDeltaTime;
            this.overlapResetStopwatch += Time.fixedDeltaTime;
            if (this.stopwatch > ChargeAgu.chargeDuration)
            {
                this.outer.SetNextStateToMain();
            }
            base.FixedUpdate();
        }
示例#2
0
    private void Start()
    {
        GetBalaIndex();

        GetRigidBody().drag = GetPlayerDeceleration();

        life  = 1;
        score = 0;
        SetCanShoot(true);
        damageable = true;

        matchController = FindObjectOfType <MatchController>();
        //matchController.AddPlayer(this);
        spawnPoint = matchController.GetSpawnPoint(this);

        teamId = 5;

        movementSM = new StateMachine();

        groundedState = new GroundedState(this, movementSM);
        shootingState = new ShootingState(this, movementSM);
        shieldState   = new ShieldState(this, movementSM);
        deadState     = new DeadState(this, movementSM);
        stunState     = new StunState(this, movementSM);
        feederState   = new FeederState(this, movementSM);

        movementSM.Initialize(shootingState);
    }
示例#3
0
 private void InitStates()
 {
     istate    = new IState[9];
     istate[0] = new IdleState(gameObject);
     istate[1] = new PatrolState(gameObject);
     istate[2] = new SuspiciousState(gameObject);
     istate[3] = new DetectionState(gameObject);
     istate[4] = new AlertState(gameObject);
     istate[5] = new AttackState(gameObject);
     istate[6] = new EscapeState(gameObject);
     istate[7] = new StunState(gameObject);
     istate[8] = new DeadState(gameObject);
 }
 // Token: 0x060012F4 RID: 4852 RVA: 0x0005149C File Offset: 0x0004F69C
 private void SetStunInternal(float duration)
 {
     if (this.targetStateMachine)
     {
         StunState stunState = new StunState();
         stunState.stunDuration = duration;
         this.targetStateMachine.SetInterruptState(stunState, InterruptPriority.Pain);
     }
     EntityStateMachine[] array = this.idleStateMachine;
     for (int i = 0; i < array.Length; i++)
     {
         array[i].SetNextStateToMain();
     }
 }
示例#5
0
    public override IEnumerator Execute()
    {
        Source.transform.LookAt(new Vector3(Target.transform.position.x, Source.transform.position.y, Target.transform.position.z));
        _animator.SetTrigger("shieldAttack");
        yield return(new WaitForSeconds(1));

        StunState check = Target.GetComponent <StunState>();

        if (check != null)
        {
            Destroy(check);
        }

        Target.gameObject.AddComponent <StunState>();
        yield return(new WaitForSeconds(1));

        status = MatchSystem.actionStatuses.end;
    }
    void Start()
    {
        playerStats.AdjustInventory();
        SpriteEquip();
        throwablePrefab = Resources.Load("Prefabs/ThrownWeapon") as GameObject;

        idle          = new IdleState(this); states.Add(idle.stateName, idle);
        move          = new MoveState(this); states.Add(move.stateName, move);
        dodge         = new DodgeState(this); states.Add(dodge.stateName, dodge);
        sprint        = new SprintState(this); states.Add(sprint.stateName, sprint);
        slide         = new SlideState(this); states.Add(slide.stateName, slide);
        combo         = new ComboState(this); states.Add(combo.stateName, combo);
        strong_attack = new StrongRedirectState(this); states.Add(strong_attack.stateName, strong_attack);
        dash_attack   = new DashRedirectState(this); states.Add(dash_attack.stateName, dash_attack);
        defense       = new DefensiveRedirectState(this); states.Add(defense.stateName, defense);
        guard         = new GuardState(this); states.Add(guard.stateName, guard);
        stun          = new StunState(this); states.Add(stun.stateName, stun);
        strike        = new StrikeState(this); states.Add(strike.stateName, strike);
        death         = new DeathState(this); states.Add(death.stateName, death);

        currentState = idle;
        currentState.StartState();
    }
示例#7
0
    private void Start()
    {
        rigidBody.drag = playerDeceleration;

        life                = maxLife;
        score               = 0;
        canShoot            = true;
        canShield           = true;
        damageable          = true;
        stunSlider.maxValue = stunTime;

        lifeText.text = "Vida: " + life;
        scoreText.GetComponent <TMPro.TextMeshProUGUI>().text = score + " pts";
        hudManager = GetComponent <HUDmanager>();
        GetBalaIndex();
        if (PhotonNetwork.IsConnected && PV.IsMine)
        {
            canvas.SetActive(true);
            mainCamera.enabled      = true;
            playerInput.enabled     = true;
            mobileCharacter.enabled = true;
            audioListener.enabled   = true;
            sAlas.Play();
        }
        if (PhotonNetwork.IsConnected && PhotonNetwork.IsMasterClient)
        {
            matchController = FindObjectOfType <MatchController>();
            matchController.AddPlayer(this);
            teamId = FindObjectOfType <RoomManager>().FindTeamIdByPlayer(PV.Owner);
            if (teamId == -1)
            {
                teamId = 0;
                Debug.Log("No se ha encontrado el teamId, se le ha añadido al equipo 0");
            }
            PV.RPC("GetSpawnpoint_RPC", RpcTarget.All, teamId);
        }
        else if (!PhotonNetwork.IsConnected)
        {
            canvas.SetActive(true);
            mainCamera.enabled      = true;
            playerInput.enabled     = true;
            mobileCharacter.enabled = true;
            RoomManagerOffline RMO = FindObjectOfType <RoomManagerOffline>();
            if (RMO.gamemodeIndex == 3)
            {
                teamId = 0;
            }
            else
            {
                teamId = RMO.jugadoresInfo[GetComponentInChildren <PlayerInput>().playerIndex + 1][1];
            }
            if (playerInput.playerIndex == 0)
            {
                audioListener.enabled = true;
            }
            matchController = FindObjectOfType <MatchController>();
            matchController.AddPlayer(this);
            spawnPoint = matchController.GetSpawnPoint(this);
            GetComponent <Transform>().position = spawnPoint.transform.position;
            hudManager.setBackground();
        }

        movementSM = new StateMachine();

        groundedState = new GroundedState(this, movementSM);
        shootingState = new ShootingState(this, movementSM);
        shieldState   = new ShieldState(this, movementSM);
        deadState     = new DeadState(this, movementSM);
        stunState     = new StunState(this, movementSM);
        feederState   = new FeederState(this, movementSM);

        movementSM.Initialize(groundedState);
    }