コード例 #1
0
 void Awake()
 {
     _rgb   = GetComponent <Rigidbody2D>();
     _ray   = GetComponent <Raycaster2D>();
     _moves = GetComponent <PlayerMove>();
     _jump  = GetComponent <JumpController>();
 }
コード例 #2
0
    /// <summary>
    /// コントローラの初期化
    /// </summary>
    private void initCatController()
    {
        playerMoveController = GameObject.Find(PathMaster.CAT_MOVE_CONTROLLER).GetComponent <PlayerMoveController>();
        jumpController       = GameObject.Find(PathMaster.JUMP_CONTROLLER).GetComponent <JumpController>();
        dashSkillController  = GameObject.Find(PathMaster.DASH_SKILL_CONTROLLER).GetComponent <CatSkillController>();
        decoySkillController = GameObject.Find(PathMaster.DECOY_SKILL_CONTROLLER).GetComponent <CatSkillController>();
        smokeSkillController = GameObject.Find(PathMaster.SMOKE_SKILL_CONTROLLER).GetComponent <CatSkillController>();
        mainCamera           = Camera.main;

        cameraAnimator = mainCamera.GetComponent <Animator>();
        CameraController cameraController = mainCamera.GetComponent <CameraController>();

        cameraController.Player = this.gameObject;
        cameraController.InitCameraController();

        this.FixedUpdateAsObservable()
        .Subscribe(x => playerBehavior());

        this.FixedUpdateAsObservable()
        .Where(x => jumpController.GetJumpable())
        .Subscribe(_ => catJump());

        this.FixedUpdateAsObservable()
        .Where(x => dashSkillController.GetSkillUsable())
        .Subscribe(_ => useDashSkill());

        this.FixedUpdateAsObservable()
        .Where(x => decoySkillController.GetSkillUsable())
        .Subscribe(_ => useDecoySkill());

        this.FixedUpdateAsObservable()
        .Where(x => smokeSkillController.GetSkillUsable())
        .Subscribe(_ => useSmokeSkill());
    }
コード例 #3
0
 void Awake()
 {
     // initialize all controllers in Awake() to make sure no collisions occur before controllers can handle them
     this.jumpController      = gameObject.GetComponent <JumpController>();
     this.movementController  = gameObject.GetComponent <MovementController>();
     this.fightMoveController = gameObject.GetComponent <FightMoveController>();
 }
コード例 #4
0
    /**
     * 控制角色移动
     * */
    void Move()
    {
        float moveSpeed = soldierSetting.runSpeed;

        // 判断角色状态
        if (playerInput.IsWalking)
        {
            moveSpeed = soldierSetting.walkSpeed;
        }
        else if (playerInput.IsCrouched)
        {
            moveSpeed = soldierSetting.crouchedSpeed;
        }
        if (playerInput.IsJumped)
        {
            JumpController.jump();
            Debug.Log("is jump");
        }

        Vector2 direction = new Vector2(playerInput.Vertical * moveSpeed, playerInput.Horizontal * moveSpeed);

        CharacterController.SimpleMove(transform.forward * direction.x + transform.right * direction.y);
        //print(Vector3.Distance(transform.position, previousPosition));
        if (Vector3.Distance(transform.position, previousPosition) > minimumMoveTreshold)
        {
            footSteps.Play();
            //print("play");
        }
        previousPosition = transform.position;
    }
コード例 #5
0
 // Use this for initialization
 void Start()
 {
     pc = GetComponent <PlayerController>(); //for passing along information about grapples hitting
     rb = GetComponent <Rigidbody>();        //for actually changing the velocity
     jc = GetComponent <JumpController>();   //for checking grounded state, in case a grapple scrapes the ground
     grappleToVelocityDirection.eulerAngles = new Vector3(0, 0, 270);
 }
コード例 #6
0
 // Start is called before the first frame update
 void Start()
 {
     rb             = GetComponent <Rigidbody2D>();
     initialGravity = rb.gravityScale;
     jumpController = GetComponent <JumpController>();
     animator       = GetComponent <Animator>();
 }
コード例 #7
0
ファイル: JumpController.cs プロジェクト: Hemaolle/platformer
 public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController)
 {
     if (grounded && jumpController.rigidbody.velocity.y <= 0)
     {
         jumpController.currentJumpState = jumpController.groundedState;
     }
 }
コード例 #8
0
 /**
  * 控制角色跳跃
  * */
 void Jump()
 {
     if (playerInput.IsJumped)
     {
         JumpController.jump();
         Debug.Log("is jump");
     }
 }
コード例 #9
0
 private void Awake()
 {
     rewiredPlayer      = ReInput.players.GetPlayer(rewiredPlayerId);
     controller         = GetComponent <Controller2D>();
     movementController = GetComponent <MovementController>();
     jumpController     = GetComponent <JumpController>();
     standardAttack     = GetComponentInChildren <PlayerAttackInfo>();
     teleportAttack     = GetComponentInChildren <PlayerTeleportAttack>();
     animatorController = GetComponent <AnimatorController>();
 }
コード例 #10
0
 private void Start()
 {
     MessageKit.addObserver(EventTypes.JUMP_INPUT_DOWN, OnJumpInputDown);
     controller         = GetComponent <Controller2D>();
     gravityController  = GetComponent <GravityController>();
     movementController = GetComponent <MovementController>();
     jumpController     = GetComponent <JumpController>();
     animController     = GetComponent <AnimatorController>();
     playerAudio        = GetComponent <PlayerAudio>();
 }
コード例 #11
0
 public override void ActivateEvent()
 {
     foreach (GameObject player in players)
     {
         JumpController jump = player.GetComponent <JumpController>();
         player.GetComponent <Rigidbody2D>().gravityScale = -1 * player.GetComponent <Rigidbody2D>().gravityScale;
         jump.jumpForce = jump.jumpForce * -1;
         jump.groundCheck.localPosition = new Vector3(jump.groundCheck.localPosition.x, -1 * jump.groundCheck.localPosition.y, jump.groundCheck.localPosition.z);
         player.GetComponent <Player>().currentEvent = eventName;
     }
 }
コード例 #12
0
 void Start()
 {
     gmc        = GetComponent <GrappleMovementController>();
     lr         = GetComponent <LineRenderer>();
     lr.enabled = false;
     jc         = GetComponent <JumpController>();
     gpc        = grappleHookProjectile.GetComponent <GrappleProjectileController>();
     InputManager.instance.OnMoveLeftDown  += () => { forwardIsRight = false; };
     InputManager.instance.OnMoveRightDown += () => { forwardIsRight = true; };
     InputManager.instance.OnGrappleDown   += () => { fireGrapple(!forwardIsRight); };
     InputManager.instance.OnGrappleUp     += () => { releaseGrapple(); };
 }
コード例 #13
0
    private bool isResetting;   //是否正在重置


    void Start()
    {
        cf   = GameObject.Find("Main Camera").GetComponent <CameraFollow>();
        jc   = GameObject.Find("Ball").GetComponent <JumpController>();
        ball = GameObject.Find("Ball");
        ChangeLevel(PlayerPrefs.GetInt("level"));
        for (int i = 0; i < resetFX.Length; i++)
        {
            resetFX[i].Stop();
        }
        isResetting = false;
    }
コード例 #14
0
    public void InitializeMe()
    {
        sensory = gameObject.GetComponent<AnimalSensory>();
        body = gameObject.GetComponent<AnimalBody>();
        brain = gameObject.GetComponent<AnimalBrain>();
        stateMachine = gameObject.GetComponent<AnimalStateMachine>();
        possesor = GameObject.FindGameObjectWithTag("Player").GetComponent<PhantomController>();
        moveSpeed = body.moveSpeed;
        isInitialized = true;

        if(stateMachine.myType == AnimalType.prairieDog)
            jumpController = gameObject.GetComponent<JumpController>();
    }
コード例 #15
0
 public override void DeactivateEvent()
 {
     eventSpawner.spawnedEvents.Remove(eventName);
     foreach (GameObject player in players)
     {
         JumpController jump = player.GetComponent <JumpController>();
         player.GetComponent <Rigidbody2D>().gravityScale = -1 * player.GetComponent <Rigidbody2D>().gravityScale;
         jump.jumpForce = jump.jumpForce * -1;
         jump.groundCheck.localPosition = new Vector3(jump.groundCheck.localPosition.x, -1 * jump.groundCheck.localPosition.y, jump.groundCheck.localPosition.z);
         player.GetComponent <Player>().currentEvent = "";
         DestroyObject(gameObject);
     }
 }
コード例 #16
0
    private void Awake()
    {
        // Players local save for starting game object its controlling.
        HandleNewControlledObject();

        if (LevelController.Instance)
        {
            LevelController.Instance.PlayerController = this;
        }

        PerkController = GetComponent <PerkController>();
        jumpController = GetComponent <JumpController>();
    }
コード例 #17
0
#pragma warning disable CS0108 // O membro oculta o membro herdado; palavra-chave new ausente
    private void Awake()
#pragma warning restore CS0108 // O membro oculta o membro herdado; palavra-chave new ausente
    {
        base.Awake();
        jump  = GetComponent <JumpController>();
        input = new InputController();

        movement.Speed      = WalkingSpeed;
        movement.ClimbSpeed = ClimbingSpeed;
        jump.JumpSpeed      = JumpingSpeed;
        health.HP           = HP;
        health.maxHP        = HP;
    }
コード例 #18
0
    // Use this for initialization
    void Start()
    {
        manager = GameObject.Find("IroIroManager");
        if (cheatMode)
        {
            manager.GetComponent <ScoreController>().ShowCanvas(true);
        }

        rb      = this.GetComponent <Rigidbody>();
        _smoke1 = smoke1.emission;
        _smoke2 = smoke2.emission;
        jc      = this.GetComponent <JumpController>();
    }
コード例 #19
0
    // Start is called before the first frame update
    void Start()
    {
        hearths          = intialhearts;
        rb               = GetComponent <Rigidbody2D>();
        staminaSlider    = GameObject.FindGameObjectWithTag("Stamina");
        experienceSlider = GameObject.FindGameObjectWithTag("Experience");
        sprites          = gameObject.GetComponentsInChildren <SpriteRenderer>();
        inventory        = gameObject.GetComponent <InventoryController>();
        animator         = gameObject.GetComponent <Animator>();
        previousGravity  = rb.gravityScale;
        GameObject ga = GameObject.FindGameObjectWithTag("Hearth");

        spriteRendHearth = ga.GetComponent <SpriteRenderer>();
        jc = GetComponent <JumpController>();
    }
コード例 #20
0
 /// <summary>
 /// Start function but instead is called after a new scene loads
 /// </summary>
 private void InitializeValues()
 {
     if (pm == null)
     {
         pm = GetComponent <PlayerNewLevelManager>();
     }
     if (!pm.initialized_Move)
     {
         wallCheck           = transform.Find("Wall Check");
         originalWallPos     = wallCheck.localPosition.x;
         pm.initialized_Move = true;
         rb             = GetComponent <Rigidbody2D>();
         jumpController = GetComponent <JumpController>();
         player         = GetComponent <Player>();
     }
 }
コード例 #21
0
ファイル: JumpController.cs プロジェクト: Hemaolle/platformer
 public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController)
 {
     if (jumpButtonPressed &&
         jumpController.wasJumpButtonReleasedInBetween)
     {
         jumpController.anim.SetBool("Jump", true);
         jumpController.jumpAudio.Play();
         jumpController.AddJumpForce();
         jumpController.currentJumpState = jumpController.airbornAddingForceState;
         jumpController.wasJumpButtonReleasedInBetween = false;
     }
     else
     {
         jumpController.anim.SetBool("Jump", false);
     }
 }
コード例 #22
0
ファイル: JumpController.cs プロジェクト: Hemaolle/platformer
 public void ProcessInputs(bool grounded, bool jumpButtonPressed, JumpController jumpController)
 {
     // The player can quickly get grounded if the ceiling is low for example
     if (grounded && jumpController.rigidbody.velocity.y <= 0)
     {
         SetJumpControllerState(jumpController, jumpController.groundedState);
     }
     else if (jumpButtonPressed && forceAddedCount < jumpController.maxForceAddTimes)
     {
         forceAddedCount++;
         jumpController.AddJumpForce();
     }
     else
     {
         SetJumpControllerState(jumpController, jumpController.airbornNotAddingForceState);
     }
 }
コード例 #23
0
    protected virtual void Start()
    {
        //MessageKit.addObserver(EventTypes.JUMP_INPUT_DOWN, JumpAnimation);
        //MessageKit<string[]>.addObserver(EventTypes.ATTACK_INPUT_DOWN_1P, TriggerAttackAnimation);
        controller         = GetComponent <Controller2D>();
        movementController = GetComponent <MovementController>();
        animator           = GetComponent <Animator>();
        sprite             = GetComponent <SpriteRenderer>();
        animationClips     = animator.runtimeAnimatorController.animationClips;
        UpdateAnimationStates();

        if (GetComponent <JumpController>() != null)
        {
            if (GetComponent <JumpController>().isActiveAndEnabled)
            {
                jumpController = GetComponent <JumpController>();
            }
        }
    }
コード例 #24
0
    private void OnEnable()
    {
        PlayerMove     move     = GetComponentInParent <PlayerMove>();
        JumpController jump     = GetComponentInParent <JumpController>();
        WallJump       walljump = GetComponentInParent <WallJump>();

        _cam._camSize = _camSize;

        jump._canJump   = _canJump;
        jump._jumpForce = _jumpForce;
        jump._nGravity  = _nGravity;
        jump._hGravity  = _hGravity;

        move._moveSpeed = _speed;

        walljump._canDoJump = _wallJump;

        _collider.size       = new Vector2(_sizeX, _sizeY);
        _collider.edgeRadius = _radious;
    }
コード例 #25
0
        private ExitStepResponse SuccessfulDetermineExitSteps(JumpController controller, string input)
        {
            var controllerResult = controller.DetermineExitSteps(input);

            return(ControllerTestHelper <ExitStepResponse> .Successful(controllerResult));
        }
コード例 #26
0
 private void FixedUpdate()
 {
     HorizontalMovementController?.FixedUpdate();
     JumpController?.FixedUpdate();
 }
コード例 #27
0
 void Start()
 {
     rb = GetComponent <Rigidbody>();
     jc = GetComponent <JumpController>();
 }
コード例 #28
0
ファイル: WallCheck.cs プロジェクト: Soverilus/Anxiety-Quest
 private void Start()
 {
     myJC = GetComponentInParent <JumpController>();
     myMB = GetComponentInParent <MovementBasic>();
 }
コード例 #29
0
 void Start()
 {
     gameManager    = GameManagerController.Instance;
     levelManager   = GameObject.FindObjectOfType <LevelManagerController>();
     jumpController = GameObject.FindObjectOfType <JumpController>();
 }
コード例 #30
0
 private void Start()
 {
     _body        = GetComponent <Rigidbody>();
     _jumpControl = GetComponent <JumpController>();
 }
コード例 #31
0
ファイル: MainController.cs プロジェクト: taobingxue/BVW
    // Use this for initialization
    void Start()
    {
        jumper = GameObject.Find("JumpController").GetComponent<JumpController>();
        main_camera = GameObject.Find ("CameraController").GetComponent<CameraController> ();
        cat = GameObject.Find("screemcat");
        dog = GameObject.Find("dog");

        //  sound background music1
        SoundManager.instance.PlayBgm (bgm1,true);
        //=================================

        posForUI = GameObject.Find ("talking_bubble5").transform.position;
        if (PlayBeginning) {
            begin_image = new Sprite[311];
            begin_image = Resources.LoadAll<Sprite> ("beginning");
        }
        go_die = new Sprite[191];
        go_die = Resources.LoadAll<Sprite> ("dog_die");
        Debug.Log (go_die.Length);
    }
コード例 #32
0
 private void Awake()
 {
     _jc = GetComponent <JumpController>();
 }
コード例 #33
0
 void Start()
 {
     sensory = gameObject.GetComponent<AnimalSensory>();
     moveSpeed = 5f; // The amount of unity units I move each frame
     moveState = PlatformingState.running;
     jumpController = gameObject.GetComponent<JumpController>();
 }
コード例 #34
0
	private int boxCollideCount = 0; // reset in PlayerController

	void Start()
	{
		instance = this;
	}