コード例 #1
0
    // private List<Node> _resultPointer;
    public override void StartGameMode()
    {
        // Dokapon = this;

        this.Name = "Dokapon/Bank";
        this.Turn = 0;

        cameras = GameObject.FindGameObjectsWithTag("MainCamera");
        GameObject[] NodeObjects = GameObject.FindGameObjectsWithTag("Node");
        nodes = new Node[NodeObjects.Length];
        for (int i = 0; i < NodeObjects.Length; i++)
        {
            nodes[i] = NodeObjects[i].GetComponent <Node>();
        }

        for (int i = 0; i < MaxPlayer; i++)
        {
            Poring poring = Instantiate(PoringPrefab).GetComponent <Poring>();
            porings.Add(poring);            //print(Random.Range(0, nodes.Length));print(porings.Count);
            // porings[0].transform.position = nodes[0].transform.position;
            Node node = nodes[UnityEngine.Random.Range(0, nodes.Length)];
            node.AddPoring(poring);

            panelPoringUI.Add("Poring " + (i + 1), 0, 0);
        }

        currentCamera = cameras[0];
        currentPoring = porings[0];


        currentCamera.GetComponent <CameraController>().SetTarget(currentPoring);

        // Initiailize sounds
        resource = GetComponent <Resource>();
        bgm      = SFX.PlayClip(resource.bgm[0], 1, true);
        bgm.GetComponent <AudioSource>().time = 3;

        print("Dokapon Start !!");
    }
コード例 #2
0
    public override void UpdateGameMode()
    {
        switch (state)
        {
        case DokaponGameState.focus:
            if (currentPoring == null)
            {
                return;
            }
            float distance = Vector3.Distance(currentPoring.transform.position, currentCamera.transform.position);            //print(distance);
            if (distance < 11.2f)
            {
                state         = DokaponGameState.roll;
                m_timeForRoll = TimeForRoll;

                // panelRoll.SetRoll(6);
            }
            break;

        case DokaponGameState.roll:
            m_timeForRoll -= Time.deltaTime;

            if (m_timeForRoll < 0)
            {
                Roll();
            }
            break;

        case DokaponGameState.plan:
            if (Input.GetMouseButtonDown(0))
            {
                RaycastHit hit;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit, 100.0f))
                {
                    Node node = hit.transform.parent.GetComponent <Node>();
                    if (node)
                    {
                        Debug.Log("You selected the " + node.nid);
                        SFX.PlayClip(resource.sound[0]).GetComponent <AudioSource>().time = 0.3f;
                        node.PointRenderer.SetPropertyBlock(MaterialPreset.GetMaterialPreset(EMaterialPreset.selected));

                        if (node.steps.Count > 0)
                        {
                            MagicCursor.Instance.MoveTo(node);
                            Route.Clear();
                            // PathToNode(node);
                            // foreach (Node n in PathToNode(node)) {
                            //  s += n.nid + ", ";
                            // }
                            RouteToNode(node);
                            // foreach (List)
                            //print(GetNodeString(PathToNode(node)));
                            // print(s);
                            foreach (List <Node> r in Route)
                            {
                                print(GetNodeString(r));
                            }
                        }
                    }
                }
            }
            break;
        }
    }
コード例 #3
0
 public void Play()
 {
     SFX.PlayClip(audio);
 }
コード例 #4
0
 public void Play(Transform target)
 {
     SFX.PlayClip(audio, target);
 }
コード例 #5
0
 public void Play()
 {
     SFX.PlayClip(this);
 }