Beispiel #1
0
 // Use this for initialization
 void Start()
 {
     _setTarget = false;
     move_ctr   = gameObject.transform.parent.GetComponentInChildren <MoveController>();
     player_ctr = GameObject.Find("Controller").GetComponent <PlayerController>();
     anim_ctr   = gameObject.transform.parent.GetComponent <AnimController>();
     direction  = move_ctr.direc;
 }
Beispiel #2
0
    public void OnMove(MoveController.Direction dir)
    {
        if (boardScript.goPlayer == null)
        {
            return;
        }

        boardScript.goPlayer.GetComponent <PlayerController>().MovePlayer(dir);
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     move_ctr     = transform.parent.GetComponentInChildren <MoveController>();
     player_ctr   = GameObject.Find("Controller").GetComponent <PlayerController>();
     PotObj       = GameObject.FindObjectOfType <PotController>().gameObject;
     anim_ctr     = move_ctr.gameObject.transform.parent.GetComponent <AnimController>();
     _onLandding  = false;
     _onFallBlock = false;
     _onMoveCloud = false;
     nowDirec     = move_ctr.direc;
 }
Beispiel #4
0
    /// <summary>
    /// ノックバック
    /// </summary>
    /// <param name="dir"></param>
    public void KnockBack(MoveController.Direction dir)
    {
        Rigidbody2D rb = GetComponent <Rigidbody2D>();

        rb.velocity = Vector2.zero;
        Vector2 knock = knockback;

        if (dir == MoveController.Direction.LEFT)
        {
            knock.x *= -1;
        }
        rb.AddForce(knock, ForceMode2D.Impulse);
    }
Beispiel #5
0
    private void Update()
    {
        Debug.Log("isLanding = " + isLanding);
        //ギミック(雲、木)に乗ってる時は弟の場所をお兄ちゃんの場所と同じにする
        if (_onLandding)
        {
            PotObj.transform.position = gameObject.transform.parent.transform.position;
            PotObj.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);

            nowDirec = move_ctr.direc;
        }
        if (gameObject.layer == LayerMask.NameToLayer("LadderPlayer") && move_ctr.InLadderCount <= 0)
        {
            player_ctr.ChangeLayer();
        }
    }
Beispiel #6
0
 /// <summary>
 /// 持つ範囲コライダーと剣を左右に合わせて移動
 /// </summary>
 private void DirecControl()
 {
     if (dir == move_ctr.direc)
     {
         return;
     }
     if (move_ctr.direc == MoveController.Direction.LEFT)
     {
         gameObject.transform.localPosition = new Vector2(0, gameObject.transform.localPosition.y);
         dir = MoveController.Direction.LEFT;
     }
     else
     {
         gameObject.transform.localPosition = new Vector2(3.8f, gameObject.transform.localPosition.y);
         dir = MoveController.Direction.RIGHT;
     }
 }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     try
     {
         OtotoHead        = gameObject.transform.GetChild(0).gameObject;
         player_ctr       = GameObject.FindObjectOfType <PlayerController>();
         move_ctr         = GameObject.FindObjectOfType <MoveController>();
         rig              = gameObject.GetComponent <Rigidbody2D>();
         BrotherObj       = move_ctr.transform.parent.gameObject;
         PotFaceSpriteObj = gameObject.transform.GetChild(gameObject.transform.childCount - 1).GetComponent <SpriteRenderer>();
     }
     catch (UnityException e)
     {
         Debug.Log(e + "が見当たらない");
     }
     direction             = move_ctr.direc;
     _potMoving            = false;
     pot_status.setPotType = PotStatus.PotType.Normal;
     pot_status.setPotFace = PotStatus.PotFace.Normal;
     setStartPotFaceSprite();
     _movePot = false;
     distance = BrotherObj.transform.position.x - gameObject.transform.position.x;
 }
Beispiel #8
0
 /// <summary>
 /// 左にツボが移動する
 /// </summary>
 public void LeftMove()
 {
     direction    = MoveController.Direction.LEFT;
     rig.velocity = new Vector2(-5f, rig.velocity.y);
 }
Beispiel #9
0
 /// <summary>
 /// 右にツボが移動する
 /// </summary>
 public void RightMove()
 {
     direction    = MoveController.Direction.RIGHT;
     rig.velocity = new Vector2(5f, rig.velocity.y);
 }