예제 #1
0
    // ======================================================================================
    private IEnumerator Fall()
    {
        CollisionCtlr            collision = this.gameObject.GetComponent <CollisionCtlr>();
        PlayerController         player    = this.gameObject.GetComponent <PlayerController>();
        Rigidbody2D              rb        = this.gameObject.GetComponent <Rigidbody2D>();
        PlayerAnimatorController animator  = this.gameObject.GetComponent <PlayerAnimatorController>();

        while (collision.Ground == null)
        {
            if (!IsPaused())
            {
                rb.simulated = true;
                UpdateGravity(player.m_configData.m_gravityRatio, player.m_configData.m_gravityMaxSpeed, rb);
            }
            else
            {
                rb.simulated = false;
            }

            yield return(new WaitForFixedUpdate());
        }

        rb.velocity  = Vector2.zero;
        rb.simulated = false;
        animator.m_animator.SetBool("IsFalling", false);
    }
예제 #2
0
 void OnValidate()
 {
     if (animatorCtrl == null)
     {
         animatorCtrl = GetComponentInChildren <PlayerAnimatorController>();
     }
 }
 private void Start()
 {
     rb             = GetComponent <Rigidbody2D>();
     playerAnimator = GetComponent <PlayerAnimatorController>();
     moveSpeed      = defaultMoveSpeed;
     jumpVelocity   = defaultJumpVelocity;
 }
예제 #4
0
 private void Start()
 {
     _playerAudio    = GetComponentInChildren <PlayerAudio>();
     _rigidbody      = GetComponent <Rigidbody>();
     _aim            = FindObjectOfType <AimCursor>();
     _playerAnimator = GetComponentInChildren <PlayerAnimatorController>();
 }
 void Awake()
 {
     animator = gameObject.AddComponent <PlayerAnimatorController>();
     visual   = transform.Find("Visual");
     body     = GetComponent <Rigidbody>();
     front    = visual.transform.Find("Front");
 }
    // ======================================================================================
    // PUBLIC MEMBERS
    // ======================================================================================
    override protected void StartPhase()
    {
        State = eStates.Idle;

        m_playerCtl     = this.gameObject.GetComponent <PlayerController>();
        m_playerAttack  = this.gameObject.GetComponent <PlayerAttack>();
        m_playerAnimCtl = this.gameObject.GetComponent <PlayerAnimatorController>();
    }
    void Start()
    {
        playerTransform = this.transform;
        playerAnimator = this.gameObject.GetComponent<Animator>();
        instance = this;

        playerScale = playerTransform.localScale;
    }
예제 #8
0
 void Awake()
 {
     this.currentRailIndex = 0;
     this.matchManager     = FindObjectOfType <MatchManager>();
     this.currentRailIndex = rails.Count - 1;
     this.currentRail      = rails[currentRailIndex];
     this.animController   = GetComponent <PlayerAnimatorController>();
     this.audioSource      = GetComponent <AudioSource>();
 }
 private void Awake()
 {
     {
         audioSource      = GetComponent <AudioSource>();
         animator         = GetComponentInParent <PlayerAnimatorController>();
         impactMemoryPool = GetComponent <ImpactMemoryPool>();
         mainCamera       = Camera.main;
     }
 }
예제 #10
0
파일: Player.cs 프로젝트: Azmalent/fusio
    void Start()
    {
        rigidBody          = GetComponent <Rigidbody>();
        animatorController = GetComponent <PlayerAnimatorController>();

        width = GetComponent <BoxCollider>().size.x;

        groundDetector = GameObject.Find(this.name + "/Ground Detector").transform;
    }
예제 #11
0
    private void Awake()
    {
        //마우스 커서 안보이게 하고, 현재 위치 고정.
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        rotateToMouse = GetComponent <RotateToMouse>();
        animator      = GetComponent <PlayerAnimatorController>();
        weapon        = GetComponentInChildren <WeaponAssaultRifle>();
    }
예제 #12
0
 private void Awake()
 {
     coneRadarSystem    = new ConeRadarSystem();
     circleRadar        = new CircleRadarSystem();
     animatorController = new PlayerAnimatorController(GetComponent <Animator>());
     NavMeshController  = new NavMeshController(GetComponent <NavMeshAgent>());
     StartCoroutine(InitJoystick());
     GetComponent <RangedAttacker>().enabled = false;
     _NPCsAround = new Collider[20];
 }
예제 #13
0
    protected void Awake()
    {
        _rigidbody      = this.GetComponent <Rigidbody>();
        _powerUpManager = this.GetComponent <RunnerPowerUpManager>();
        _playerAnimator = this.GetComponent <PlayerAnimatorController>();
        _runner         = new Mover(this, _maxRunSpeed);
        _walker         = new Mover(this, _walkingSpeed);

        _mover = _runner;
    }
예제 #14
0
    void Start()
    {
        controller          = GetComponent <CharacterController2D>();
        animationController = GetComponentInChildren <PlayerAnimatorController>();
        CalculateJumpForceAndGravity();
        CalculateDashForce();

        playerStatus.readHorizontalInput = true;
        playerStatus.canAttack           = true;
    }
예제 #15
0
 void OnValidate()
 {
     if (agent == null)
     {
         agent = GetComponent <NavMeshAgent>();
     }
     if (animatorCtrl == null)
     {
         animatorCtrl = GetComponentInChildren <PlayerAnimatorController>();
     }
 }
예제 #16
0
 private void Start()
 {
     m_CurrentHealth = m_StartingHealth + m_HealthModifier;
     m_Dead          = false;
     pAnimC          = GetComponentInChildren <PlayerAnimatorController>();
     playerLight     = GetComponentInChildren <Light>();
     startLight      = playerLight.range;
     SetHealthUI();
     SetLight();
     InvokeRepeating("regen", 0, 1);
 }
 void Start()
 {
     playerRgb = this.GetComponent<Rigidbody2D>();
     playerTransform = this.transform;
     groundDetector = GameObject.Find(this.name + "/GroundDetector").transform;
     enemiesDetector0 = GameObject.Find(this.name + "/EnemiesDetector0").transform;
     enemiesDetector1 = GameObject.Find(this.name + "/EnemiesDetector1").transform;
     enemiesDetector2 = GameObject.Find(this.name + "/EnemiesDetector2").transform;
     playerAnimator = PlayerAnimatorController.instance;
     health = 6;
 }
    // ======================================================================================
    // PUBLIC MEMBERS
    // ======================================================================================
    public void Start()
    {
        m_animator = this.gameObject.GetComponent <PlayerAnimatorController>();

        m_actualState = m_states.Length - 1;
        m_actualTimer = 0;
        if (m_watcherToShowWeapon != null)
        {
            m_watcherToShowWeapon.Drop();
        }
    }
예제 #19
0
    void Start()
    {
        animator = GetComponentInChildren <Animator>();

        stats                    = GetComponent <CharacterStats>();
        playerMotor              = GetComponent <PlayerMotor>();
        colliderplayer           = GetComponent <CapsuleCollider2D>();
        meleeWeapon              = GetComponent <MeleeWeaponController>();
        rangedWeapon             = GetComponent <RangedWeaponController>();
        playerAnimatorController = GetComponent <PlayerAnimatorController>();
        //currentAttackCycle = weapon1.combatPattern.Length;
        //cycleLenght = currentAttackCycle;
    }
예제 #20
0
    private void Awake()
    {
        _rb          = GetComponent <Rigidbody>();
        _animator    = GetComponentInChildren <PlayerAnimatorController>();
        _boxCollider = this.gameObject.GetComponent <BoxCollider>();

        _heading = Vector3.forward;
        float groundXBound = _boxCollider.bounds.extents.x - GroundSkinOffset;
        float groundZBound = _boxCollider.bounds.extents.z - GroundSkinOffset;

        _groundSkinVertices[0] = new Vector3(groundXBound, 0, groundZBound);
        _groundSkinVertices[1] = new Vector3(groundXBound, 0, -groundZBound);
        _groundSkinVertices[2] = new Vector3(-groundXBound, 0, -groundZBound);
        _groundSkinVertices[3] = new Vector3(-groundXBound, 0, groundZBound);
        for (int i = 0; i < 4; i++)
        {
            float xDiff  = _groundSkinVertices[(i + 1) % 4].x - _groundSkinVertices[i].x;
            float zDiff  = _groundSkinVertices[(i + 1) % 4].z - _groundSkinVertices[i].z;
            float zStart = _groundSkinVertices[i].z;
            float xStart = _groundSkinVertices[i].x;

            for (int j = 0; j < 9; j++)
            {
                _groundSkinVertices[j + 4 + (9 * i)] = new Vector3(xStart + ((xDiff / 9) * (j + 1)),
                                                                   0,
                                                                   zStart + ((zDiff / 9) * (j + 1)));
            }
        }

        float forwardYBound = _boxCollider.bounds.extents.y - ForwardSkinOffset;
        float forwardZBound = _boxCollider.bounds.extents.z - ForwardSkinOffset;

        _forwardSkinVertices[0] = new Vector3(0, forwardYBound, forwardZBound);
        _forwardSkinVertices[1] = new Vector3(0, forwardYBound, -forwardZBound);
        _forwardSkinVertices[2] = new Vector3(0, -forwardYBound, -forwardZBound);
        _forwardSkinVertices[3] = new Vector3(0, -forwardYBound, forwardZBound);
        for (int i = 0; i < 4; i++)
        {
            float yDiff  = _forwardSkinVertices[(i + 1) % 4].y - _forwardSkinVertices[i].y;
            float zDiff  = _forwardSkinVertices[(i + 1) % 4].z - _forwardSkinVertices[i].z;
            float yStart = _forwardSkinVertices[i].y;
            float zStart = _forwardSkinVertices[i].z;

            for (int j = 0; j < 3; j++)
            {
                _forwardSkinVertices[j + 4 + (3 * i)] = new Vector3(0,
                                                                    yStart + ((yDiff / 4) * (j + 1)),
                                                                    zStart + ((zDiff / 4) * (j + 1)));
            }
        }
    }
예제 #21
0
    private void OnDestroy()
    {
        foreach (BlockPlugin plugin in _plugins)
        {
            Destroy(plugin);
        }

        PlayerAnimatorController playerAnimControl = GetComponentInChildren <PlayerAnimatorController>();

        if (playerAnimControl != null)
        {
            playerAnimControl.UnParentPlayer();
        }
    }
 public PlayerController(GameObject playerGmj, Message_ServerCommand_CreateGameObject info, UnityPlayerData generalPlayerData, IDeviceInput deviceInput)
 {
     alive = true;
     playerScoreController  = new PlayerScoreController();
     spellCaster            = new SpellCasterController(this);
     playerAnimator         = new PlayerAnimatorController(playerGmj);
     healthController       = new PlayerHealthController(this, generalPlayerData);
     this.playerGmj         = playerGmj;
     this.generalPlayerData = generalPlayerData;
     PlayerControllerGUID   = info.GmjGUID;
     OwnerID = info.OwnerGUID;
     playerGmj.transform.position = new Vector3(info.transform.xPos, StaticVariables.GetYPos(), info.transform.zPos);
     targetPos        = playerGmj.transform.position;
     this.deviceInput = deviceInput;
 }
    // ======================================================================================
    // PUBLIC MEMBERS
    // ======================================================================================
    public void Start()
    {
        m_direction = PlayerAnimatorController.eDirections.Right;
        m_state     = PlayerAnimatorController.eStates.Idle;
        m_animator  = this.GetComponent <PlayerAnimatorController>();

#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            return;
        }
#endif

        m_dashTimer     = m_dashDuration;
        m_dashDirection = Vector2.right;

        m_dashCooldownTimer = m_dashCoolDownDuration;

        m_collisionEpsilon = PhysicsMgr.CollisionDetectionPrecision;
    }
예제 #24
0
 void OnValidate()
 {
     if (animatorCtrl == null)
     {
         animatorCtrl = GetComponentInChildren <PlayerAnimatorController>();
     }
     if (runner == null)
     {
         runner = GetComponent <Runner>();
     }
     if (kicker == null)
     {
         kicker = GetComponent <Kicker>();
     }
     if (jumper == null)
     {
         jumper = GetComponent <Jumper>();
     }
     if (climber == null)
     {
         climber = GetComponent <Climber>();
     }
 }
 // Use this for initialization
 void Start()
 {
     PlayerStats = FindObjectOfType <PlayerStats>();
     PlayerAnimatorController = FindObjectOfType <PlayerAnimatorController>();
 }
예제 #26
0
 void Awake()
 {
     _animator         = GetComponentInChildren <PlayerAnimatorController>();
     _playerController = GetComponent <PlayerController>();
 }
예제 #27
0
 void Start()
 {
     animator    = GetComponentInChildren <Animator>();
     playerMotor = GetComponent <PlayerMotor>();
     playerAnimatorController = GetComponent <PlayerAnimatorController>();
 }
예제 #28
0
 void Start()
 {
     animatiorController = GetComponent <PlayerAnimatorController>();
 }
예제 #29
0
    void Awake()
    {
        animatorController = this.GetComponent<PlayerAnimatorController>();
        movementController = this.GetComponent<PlayerMovement>();

        if (animatorController == null) throw new MissingReferenceException("Missing a reference to the PlayerAnimatorControler on the " + this.gameObject);
        if (movementController == null) throw new MissingReferenceException("Missing a reference to the PlayerMovement on the " + this.gameObject);

        animatorController.OnMenuAnimationsExit += movementController.Enable;

        startPosition = this.transform.position;
        startRotation = this.transform.rotation;
    }