コード例 #1
0
    /*======================*/
    //  初期化
    /*======================*/
    void Awake()
    {
        // 初期座標を設定
        transform.position = new Vector3(-175.3f, -42.0f, 0.0f);

        b_JumpFlag       = false;
        b_CameraMoveFlag = false;

        g_Move = new Move();

        g_HP = GetComponent <HP>();
        g_HP.SetHP(cf_HPMax);
        b_AliveFlag = true;

        an_Mortion     = GetComponent <Animator>();
        n_MortionState = (int)Mortion.Stay;

        g_right2D = GetComponent <Rigidbody2D>();

        n_LeftRightFlag = (int)Direction.Right;

        g_Damege       = GameObject.Find("DamageEffect");
        g_DamegeScript = g_Damege.GetComponent <FlushController>();

        g_Jump    = GameObject.Find("Jump_Effect");
        je_Effect = g_Jump.GetComponent <JumpEffect>();
        g_Jump.SetActive(false);

        as_Sound = GetComponents <AudioSource>();
    }
コード例 #2
0
 void SettleMiscValues()
 {
     myJE                       = GetComponent <JumpEffect>();
     myGameController           = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
     myGameController.whichTile = whichTile;
     myEndGoal                  = myEndGoalTransform.position.x;
 }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        t         = 0f;
        startPos  = transform.position;
        sprite    = transform.Find("Sprite");
        origScale = sprite.localScale;
        JumpEffect effect = GetComponent <JumpEffect>();

        effect.duration = duration;
        effect.PlayEffect();
    }
コード例 #4
0
ファイル: Player.cs プロジェクト: fshh/Negative-Space
 private void Start()
 {
     controller      = GetComponent <Controller2D>();
     platformManager = FindObjectOfType <PlatformManager>();
     gravity         = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);
     maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
     minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);
     audioSource     = GetComponent <AudioSource>();
     anim            = GetComponentInChildren <Animator>();
     jumpEffect      = GetComponent <JumpEffect>();
     input           = GetComponent <PlayerInput>();
 }
コード例 #5
0
 void GrabStats()
 {
     //player = GameObject.FindGameObjectWithTag("Player");
     myMS         = player.GetComponent <MovementStats>();
     myJE         = myMS.myJE;
     whatIsGround = myMS.whatIsGround;
     jumpForce    = myMS.jumpForce;
     jumpTime     = myMS.jumpTime;
     myMoveSpeed  = myMS.myMoveSpeed;
     myPM         = myMS.myPhysMaterial;
     origFriction = myPM.friction;
     playerCol    = player.GetComponent <Collider2D>();
     canJump      = myMS.canJump;
     gCheck       = groundChecker.GetComponent <CapsuleCollider2D>();
     //sets the jumpCounter to whatever we set our jumptime to in the editor
     jumpTimeCounter = jumpTime;
     myRB            = player.GetComponent <Rigidbody2D>();
     myPM            = myMS.myPhysMaterial;
 }