Esempio n. 1
0
 // Start is called before the first frame update
 void Start()
 {
     padController = padControllerObj.GetComponent <PadController>();
     boardCast     = false;
     animator      = GetComponent <Animator>();
     time          = 0;
 }
Esempio n. 2
0
    public IPadController[] CreateButtonsWithCurrentLesson()
    {
        int amount = this.currentLesson.rhythm.beat.Length;

        this.rhythmController.AudioController.Init(amount);
        float scaleX = 10f / (float)amount;
        float posX   = -5f + scaleX / 2f;
        List <IPadController> list = new List <IPadController>();

        for (int i = 0; i < amount; i++)
        {
            GameObject    btnObj      = (GameObject)UnityEngine.Object.Instantiate(this.rhythmController.PrefaBtn);
            RectTransform rtContainer = this.rhythmController.Container;
            btnObj.GetComponent <RectTransform> ().SetParent(rtContainer, false);
            btnObj.GetComponent <Image> ().color = this.btnColor [i];

            CreateEndCube(scaleX, posX, i);
            GameObject    newObj = CreateStartCube(scaleX, posX, i);
            PadController pc     = newObj.AddComponent <PadController> ();
            pc.Init(this.rhythmController, this.rhythmStreak, i,
                    this.currentLesson.rhythm.beat[i].bpms,
                    this.currentLesson.rhythm.bar,
                    this.rhythmController.Pool,
                    this.rhythmController.PrefabPad,
                    this.rhythmController.ContainerPad);
            list.Add(pc as IPadController);
        }
        return(list.ToArray());
    }
Esempio n. 3
0
 //寻找板子
 public static void findPad()
 {
     if (pad == null)
     {
         pad      = GameObject.Find("Pad");
         pad_ctrl = pad.GetComponent <PadController>();
     }
 }
Esempio n. 4
0
 // Start is called before the first frame update
 void Start()
 {
     gameStop      = false;
     controllerPas = controllerObject.GetComponent <PadController>();
     cameraPas     = cameraObject.GetComponent <CameraController>();
     this.animator = GetComponent <Animator>();
     rb            = GetComponent <Rigidbody>();
 }
Esempio n. 5
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PadController ctrl = collision.gameObject.GetComponent <PadController>();

        if (ctrl != null)
        {
            pad = collision.gameObject;
            padGot();
        }
    }
Esempio n. 6
0
 public override void padGot()
 {
     if (pad != null)
     {
         PadController ctrl = pad.GetComponent <PadController>();
         ctrl.compactPad();
     }
     Destroy(gameObject);
     base.padGot();
 }
Esempio n. 7
0
    public void GeneratePlatform()
    {
        DeleteObjectWithTag(PLATFORM_TAG);

        float lastY = 0.0f;
        float lastX = -5.0f;

        float minTime = GetMinDeltaTime();

        GameObject platforms = new GameObject(PLATFORM_TAG);

        platforms.tag = PLATFORM_TAG;
        GameObject       player     = GameObject.FindGameObjectWithTag("Player");
        PlayerController playerCtrl = player.GetComponent <PlayerController>();

        for (int i = 0; i < GameController.Instance.onsetList.Count; i++)
        {
            float curX = GameController.Instance.onsetList[i].positionX;
            Nullable <GeneratorConfig> curConfig = GetCurrentConfig(curX);

            float randomNumber = UnityEngine.Random.Range(0, 1.0f);
            if (curConfig == null || randomNumber > curConfig.Value.generateRate)
            {
                continue;
            }

            float maxTime   = GetMaxDeltaTime(lastY);
            float deltaTime = (curX - lastX) / playerCtrl.horizontalSpeed;
            if (deltaTime < minTime)
            {
                continue;
            }

            float t    = UnityEngine.Random.Range(minTime, Mathf.Min(maxTime, deltaTime));
            float curY = lastY + calculateDeltaY(t);

            GameObject prefab = GetRandomPlatformPrefab(curConfig.Value.platformPrefabs);
            GameObject obj    = GameObject.Instantiate(prefab) as GameObject;
            obj.transform.parent = platforms.transform;
            GameObject hint = GameObject.Instantiate(Resources.Load("Prefabs/Hint")) as GameObject;
            hint.transform.SetParent(platforms.transform);

            obj.transform.position  = new Vector3(lastX, curY, 0);
            hint.transform.position = new Vector3(curX, curY + 0.5f, 0);
            PadController  ctrl   = obj.GetComponentInChildren <PadController>();
            SpriteRenderer sprite = ctrl.GetComponent <SpriteRenderer>();
            ctrl.transform.localPosition = new Vector3((curX - lastX) / 2 + 1.1f, -sprite.size.y / 2, 0);
            sprite.size = new Vector2((curX - lastX) - 1.1f, sprite.size.y);


            lastX = curX;
            lastY = curY;
        }
    }
Esempio n. 8
0
    void Start()
    {
        velocity = new Vector3 ();

        controllerSettings = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameData>().controllerSettings;
        if(controllerSettings == null) Debug.Log ("ERROR NO SE ENCONTRO LA CONFIGURACION POR DEFECTO");

        pauseGame = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameData> ().paused;

        Pad = GameObject.Find ("PadController").GetComponent<PadController> ();
    }
Esempio n. 9
0
 void Start()
 {
     //初始化变量
     pad      = transform.parent.gameObject;
     pad_ctrl = pad.GetComponent <PadController>();
     //计算每帧变化量
     if (Time.deltaTime > 0)
     {
         deltaScale = pad_ctrl.deltaScale / (liveTime / Time.deltaTime);
     }
     else
     {
         deltaScale = pad_ctrl.deltaScale / (liveTime / 0.0167f);
     }
 }
Esempio n. 10
0
 private void Start()
 {
     //初始化pad
     if (levelController.pad != null)
     {
         pad = levelController.pad;
     } else
     {
         pad = GameObject.Find("Pad");
         if (pad != null)
         {
             levelController.pad = pad;
         }
     }
     ctrl = pad.GetComponent<PadController>();
     //反转
     ctrl.reverse();
 }
Esempio n. 11
0
    public override void Enter()
    {
        goalAreas = MonoBehaviour.FindObjectsOfType <GoalArea>();
        ai        = MonoBehaviour.FindObjectOfType <AirHockeyAI>();
        player    = MonoBehaviour.FindObjectOfType <PadController>();

        foreach (GoalArea area in goalAreas)
        {
            // ゴールしたときの処理を登録
            area.OnGoaled = (type) =>
            {
                puck.SetActive(false);
                ai.SetActiveOperation(false);
                player.SetActiveOperation(false);

                // 塗られた色の割合を求め,スコアに適用する
                float ratio = DynamicPaintManager.Instance.ComputeColorRatio(type);
                ScoreStore.Instance.IncrementPoint(type, ratio);
            };
        }

        // スコアが更新されたときの処理を登録
        inGameUiController.OnScoreUpdated = () =>
        {
            // 現在のゲームをリセットする
            if (ScoreStore.Instance.Round < MaxRound)
            {
                Reset();
            }
            // 最大ラウンドまでしたら,ゲーム終了
            else
            {
                isGameFinished = true;
            }
        };

        ai.Initialize(new HS_Normal());
        inGameUiController.PlayView();
        Reset();
    }
Esempio n. 12
0
 void Update()
 {
     if (delayTime > 0)
     {
         delayTime -= Time.deltaTime;
     }
     else
     {
         //发射激光
         if (!islaunched)
         {
             PadController ctrl = pad.GetComponent <PadController>();
             ctrl.launchLaser();
             islaunched = true;
         }
         if (particle.isStopped)
         {
             //播放停止后销毁
             Destroy(gameObject);
         }
     }
 }
Esempio n. 13
0
    void OnTriggerExit2D(Collider2D other)
    {
        if (!other.CompareTag("Pad"))
        {
            return;
        }

        PadController controller = other.gameObject.GetComponent <PadController>();

        if (controller == null)
        {
            return;
        }

        if (controller.controlType == PadController.ControlType.RIGHT_PAD)
        {
            playerController.SendMessage("EnableRightJump", false);
        }
        else if (controller.controlType == PadController.ControlType.LEFT_PAD)
        {
            playerController.SendMessage("EnableLeftJump", false);
        }
    }
Esempio n. 14
0
 private void OnDestroy()
 {
     this.padController = null;
 }
Esempio n. 15
0
    //============================================================================================
    //============================================================================================
    // Use this for initialization
    void Start()
    {
        //this code just gets the positions for the various controller components that are rendered
        padC = GameObject.Find("ControllerObject").GetComponent <PadController>();

        leftbutton_t  = GameObject.Find("leftbutton").GetComponent <Transform>();
        rightbutton_t = GameObject.Find("rightbutton").GetComponent <Transform>();
        upbutton_t    = GameObject.Find("upbutton").GetComponent <Transform>();
        downbutton_t  = GameObject.Find("downbutton").GetComponent <Transform>();

        abutton_t = GameObject.Find("abutton").GetComponent <Transform>();
        bbutton_t = GameObject.Find("bbutton").GetComponent <Transform>();
        xbutton_t = GameObject.Find("xbutton").GetComponent <Transform>();
        ybutton_t = GameObject.Find("ybutton").GetComponent <Transform>();

        ltbutton_t = GameObject.Find("lefttop").GetComponent <Transform>();
        rtbutton_t = GameObject.Find("righttop").GetComponent <Transform>();

        //pbutton_t = GameObject.Find("pause").GetComponent<Transform>();
        bkbutton_t = GameObject.Find("back").GetComponent <Transform>();
        hbutton_t  = GameObject.Find("home").GetComponent <Transform>();
        sbutton_t  = GameObject.Find("start").GetComponent <Transform>();

        //object positions for analog stick models
        leftjoystick_t      = GameObject.Find("leftjoystick").GetComponent <Transform>();
        leftjoystickUp      = leftjoystick_t.localPosition;
        leftjoystickDown    = leftjoystickUp;
        leftjoystickDown.y -= 0.1f;

        rightjoystick_t      = GameObject.Find("rightjoystick").GetComponent <Transform>();
        rightjoystickUp      = rightjoystick_t.localPosition;
        rightjoystickDown    = rightjoystickUp;
        rightjoystickDown.y -= 0.1f;

        //object positions for analog triggers
        ltrigger_t = GameObject.Find("ltrigger").GetComponent <Transform>();
        rtrigger_t = GameObject.Find("rtrigger").GetComponent <Transform>();


        //object positions for dpad buttons
        leftbuttonUp      = leftbutton_t.localPosition;
        leftbuttonDown    = leftbuttonUp;
        leftbuttonDown.y -= 0.1f;

        rightbuttonUp      = rightbutton_t.localPosition;
        rightbuttonDown    = rightbuttonUp;
        rightbuttonDown.y -= 0.1f;

        upbuttonUp      = upbutton_t.localPosition;
        upbuttonDown    = upbuttonUp;
        upbuttonDown.y -= 0.1f;

        downbuttonUp      = downbutton_t.localPosition;
        downbuttonDown    = downbuttonUp;
        downbuttonDown.y -= 0.1f;

        //object positions for action buttons
        abuttonUp      = abutton_t.localPosition;
        abuttonDown    = abuttonUp;
        abuttonDown.y -= 0.1f;

        bbuttonUp      = bbutton_t.localPosition;
        bbuttonDown    = bbuttonUp;
        bbuttonDown.y -= 0.1f;

        xbuttonUp      = xbutton_t.localPosition;
        xbuttonDown    = xbuttonUp;
        xbuttonDown.y -= 0.1f;

        ybuttonUp      = ybutton_t.localPosition;
        ybuttonDown    = ybuttonUp;
        ybuttonDown.y -= 0.1f;

        //object positions for shoulder buttons
        ltbuttonUp      = ltbutton_t.localPosition;
        ltbuttonDown    = ltbuttonUp;
        ltbuttonDown.z += 0.1f;

        rtbuttonUp      = rtbutton_t.localPosition;
        rtbuttonDown    = rtbuttonUp;
        rtbuttonDown.z += 0.1f;

        //start
        sbuttonUp      = sbutton_t.localPosition;
        sbuttonDown    = sbuttonUp;
        sbuttonDown.y -= 0.1f;

        //middle
        mbuttonUp      = hbutton_t.localPosition;
        mbuttonDown    = mbuttonUp;
        mbuttonDown.y -= 0.1f;

        //back
        bkbuttonUp      = bkbutton_t.localPosition;
        bkbuttonDown    = bkbuttonUp;
        bkbuttonDown.y -= 0.1f;
    }
 // Start is called before the first frame update
 void Start()
 {
     ChangeSummonMode(startMode);
     padController = padControllerObj.GetComponent <PadController>();
     Atksignal     = false;
 }
Esempio n. 17
0
 void OnEnable()
 {
     padController = padControllerObj.GetComponent <PadController>();
     Exit.gameObject.SetActive(false);
     padController.boardcast = false;
 }
 /// <summary>
 /// 初期化
 /// </summary>
 private void Initialize()
 {
     keyboard_controller = new KeboardController();  //キーボード実体生成
     pad_controller      = new PadController();      //パッド実体生成
 }
Esempio n. 19
0
 public void InitWithPadController(PadController newPadController)
 {
     this.padController = newPadController;
 }
    //============================================================================================
    //============================================================================================
    // Use this for initialization
    void Start()
    {
        //this code just gets the positions for the various controller components that are rendered
        padC = GameObject.Find("ControllerObject").GetComponent<PadController>();

        leftbutton_t = GameObject.Find("leftbutton").GetComponent<Transform>();
        rightbutton_t = GameObject.Find("rightbutton").GetComponent<Transform>();
        upbutton_t = GameObject.Find("upbutton").GetComponent<Transform>();
        downbutton_t = GameObject.Find("downbutton").GetComponent<Transform>();

        abutton_t = GameObject.Find("abutton").GetComponent<Transform>();
        bbutton_t = GameObject.Find("bbutton").GetComponent<Transform>();
        xbutton_t = GameObject.Find("xbutton").GetComponent<Transform>();
        ybutton_t = GameObject.Find("ybutton").GetComponent<Transform>();

        ltbutton_t = GameObject.Find("lefttop").GetComponent<Transform>();
        rtbutton_t = GameObject.Find("righttop").GetComponent<Transform>();

        pbutton_t = GameObject.Find("pause").GetComponent<Transform>();

        //object positions for analog stick models
        leftjoystick_t = GameObject.Find("leftjoystick").GetComponent<Transform>();
        leftjoystickUp = leftjoystick_t.localPosition;
        leftjoystickDown = leftjoystickUp;
        leftjoystickDown.y -= 0.1f;

        rightjoystick_t = GameObject.Find("rightjoystick").GetComponent<Transform>();
        rightjoystickUp = rightjoystick_t.localPosition;
        rightjoystickDown = rightjoystickUp;
        rightjoystickDown.y -= 0.1f;

        //object positions for analog triggers
        ltrigger_t = GameObject.Find("ltrigger").GetComponent<Transform>();
        rtrigger_t = GameObject.Find("rtrigger").GetComponent<Transform>();

        //object positions for dpad buttons
        leftbuttonUp = leftbutton_t.localPosition;
        leftbuttonDown = leftbuttonUp;
        leftbuttonDown.y -= 0.1f;

        rightbuttonUp = rightbutton_t.localPosition;
        rightbuttonDown = rightbuttonUp;
        rightbuttonDown.y -= 0.1f;

        upbuttonUp = upbutton_t.localPosition;
        upbuttonDown = upbuttonUp;
        upbuttonDown.y -= 0.1f;

        downbuttonUp = downbutton_t.localPosition;
        downbuttonDown = downbuttonUp;
        downbuttonDown.y -= 0.1f;

        //object positions for action buttons
        abuttonUp = abutton_t.localPosition;
        abuttonDown = abuttonUp;
        abuttonDown.y -= 0.1f;

        bbuttonUp = bbutton_t.localPosition;
        bbuttonDown = bbuttonUp;
        bbuttonDown.y -= 0.1f;

        xbuttonUp = xbutton_t.localPosition;
        xbuttonDown = xbuttonUp;
        xbuttonDown.y -= 0.1f;

        ybuttonUp = ybutton_t.localPosition;
        ybuttonDown = ybuttonUp;
        ybuttonDown.y -= 0.1f;

        //object positions for shoulder buttons
        ltbuttonUp = ltbutton_t.localPosition;
        ltbuttonDown = ltbuttonUp;
        ltbuttonDown.z += 0.1f;

        rtbuttonUp = rtbutton_t.localPosition;
        rtbuttonDown = rtbuttonUp;
        rtbuttonDown.z += 0.1f;

        //pause
        pbuttonUp = pbutton_t.localPosition;
        pbuttonDown = pbuttonUp;
        pbuttonDown.y -= 0.1f;
    }
 void Start()
 {
     controllerPas = controllerObject.GetComponent <PadController>();
 }
Esempio n. 22
0
 private void Start()
 {
     pad_ctrl = GetComponent <PadController>();
 }