コード例 #1
0
ファイル: UIMaster.cs プロジェクト: FungusSamurai/LittleWars
    public static IEnumerator MoveCurtains(bool lower)
    {
        instance.movingCurtains = true;
        int     increment = 0;
        Vector2 startPos  = instance.curtainsPos.anchoredPosition;

        if (lower) //lower curtains
        {
            SoundMaster.CurtainDown();
            while (increment < 101)
            {
                instance.curtainsPos.anchoredPosition = Vector2.Lerp(startPos, new Vector2(0, 0), 0.01f * increment);
                increment += 1;
                yield return(null);
            }
        }

        else //raise curtains
        {
            SoundMaster.CurtainUp();
            while (increment < 101)
            {
                instance.curtainsPos.anchoredPosition = Vector2.Lerp(startPos, new Vector2(0, instance.topCurtainPos), 0.01f * increment);
                increment += 1;
                yield return(null);
            }
        }

        instance.movingCurtains = false;
    }
コード例 #2
0
    static IEnumerator HandleSmoke() //Enlarges and fades out the smoke cloud
    {
        GameObject smokeCloud = GameObject.Find("SmokeCloud");

        smokeCloud.GetComponent <CanvasGroup>().alpha = 1.0f; //Makes smoke visible
        Vector3 scaler      = new Vector3(0.08f, 0.2f, 0.0f);
        bool    endingFight = false;                          //The units are still "fighting" behind the smoke cloud. Becomes true once the smoke cloud is big enough to cover the units
        float   timer       = 0.7f;

        SoundMaster.AttackFighting();

        while (smokeCloud.GetComponent <CanvasGroup>().alpha > 0)
        {
            smokeCloud.transform.localScale += scaler;                                  //Increases the size of the smoke cloud
            if (timer < 0)                                                              //If the smoke cloud is big enough
            {
                smokeCloud.GetComponent <CanvasGroup>().alpha -= Time.deltaTime / 2.5f; //Fade out smoke cloud

                if (!endingFight)                                                       //If we haven't started knocking down units
                {
                    KnockdownUnits();
                    endingFight = true;
                }
            }
            timer -= Time.deltaTime;
            yield return(null);
        }

        yield return(new WaitForSeconds(1.0f));

        fighting = false;
    }
コード例 #3
0
	void btnsnd(){
		GameObject obj = GameObject.Find ("SoundMaster");
		if (obj != null) {
			SoundMaster script = obj.GetComponent<SoundMaster> ();
			script.PlaySEStgSnd ();
		}
	}
コード例 #4
0
    public void firecannon()
    {
        actual = cannon_power * percent;

        DestroyIndicator();

        if (c.Shots == Cannon.Clip)
        {
            MoveMaster.UnitsToMove--;
            c.Moved = true;
        }
        if (selected == true && c.Shots > 0)
        {
            if (CanShoot) //Half a second has to have passed before the next shot can fire (Brennan)
            {
                //Destroy code here

                cannonball = (GameObject)Instantiate(CannonballPrefab, ShotSpawn.transform.position, ShotSpawn.transform.rotation);
                cannonball.GetComponent <Rigidbody>().AddForce(ShotSpawn.transform.forward * actual);
                CanShoot = false;
                c.Shots--;

                ParticleSystem ps = transform.GetChild(1).gameObject.GetComponent <ParticleSystem>();
                //shader = Shader.Find("Mobile/Particles/Multiply");
                ps.Play();
                SoundMaster.FireCannon();
                StartCoroutine(ShakeCannon());
            }
        }
    }
コード例 #5
0
    public static void SetTutorialTiles()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0) /*&& Events.GetComponent<Pause>().paused == false*/)
        {
            Ray        ray;
            RaycastHit hit;
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {
                string[] index;
                if ((hit.transform.tag == "I" && instance.toSpawnUnit == 0) ||
                    (hit.transform.tag == "CV" && instance.toSpawnUnit == 1) ||
                    (hit.transform.tag == "CN" && instance.toSpawnUnit == 2)) //toSpawnUnit is the same unit as the required unit of the hexcell they clicked on
                {
                    index = hit.transform.gameObject.name.Split('_');
                    HexCell h   = MapMaster.Map[int.Parse(index[0]), int.Parse(index[1])];
                    int     tSU = instance.toSpawnUnit;
                    instance.unitsUsed[tSU]--;
                    instance.uoList.Add(new UnitOrder(h.r, h.q, tSU, (GameObject)GameObject.Instantiate(Resources.Load("prefabs/UnitImagePlane"), MapMaster.Map[h.R, h.Q].spawnPoint.transform.position + new Vector3(0.0f, 0.05f, 0.0f), Quaternion.Euler(0.0f, 180.0f * PlayerMaster.CurrentTurn, 0.0f))));

                    SoundMaster.Deploy();

                    MapMaster.Map[h.R, h.Q].Passable = false;

                    instance.uoList[instance.uoList.Count - 1].icon.GetComponent <ImagePlaneTest>().SetUnitPicture(((UnitTypes)tSU).ToString(), PlayerMaster.CurrentTurn);

                    UIMaster.UpdateDeployAmount();
                    GameObject.Destroy(hit.transform.parent.gameObject);
                }
            }
        }
    }
コード例 #6
0
 public void OnGameStatusChanged(SingleGameLogic.GameStatus status)
 {
     if (status == SingleGameLogic.GameStatus.BotsTurn)
     {
         field.Deactivate();
         statusText.Text    = "BOT'S TURN...";
         statusText.ColorID = ColorBank.Blue;
     }
     if (status == SingleGameLogic.GameStatus.PlayersTurn)
     {
         field.Activate();
         statusText.Text    = "YOUR TURN";
         statusText.ColorID = ColorBank.Yellow;
     }
     if (status == SingleGameLogic.GameStatus.Lose)
     {
         field.Deactivate();
         statusText.Text    = "YOU LOSE";
         statusText.ColorID = ColorBank.Blue;
         bar.OnGameEnd();
         SoundMaster.PlaySound(SoundMaster.FailureSound);
     }
     if (status == SingleGameLogic.GameStatus.Win)
     {
         field.Deactivate();
         statusText.Text    = "YOU WIN";
         statusText.ColorID = ColorBank.Yellow;
         bar.OnGameEnd();
         SoundMaster.PlaySound(SoundMaster.VictorySound);
     }
 }
コード例 #7
0
    public static IEnumerator ToBattle()
    {
        GameObject P1Side = GameObject.Find("Player1Units");
        GameObject P2Side = GameObject.Find("Player2Units");

        float increment = 0;
        //Vector2 meetingPoint = new Vector2(Screen.width/2 /*1000/2*/, 0);
        Vector2 meetingPoint  = new Vector2((Screen.width / 2) - (Screen.width / 8) /*1000/2*/, 0);
        bool    handlingSmoke = false; //The smokecloud is currently not on the screen

        SoundMaster.AttackCharge();

        while (/*P1Side.transform.position.x < P2Side.transform.position.x*/ P1Side.GetComponent <RectTransform>().anchoredPosition.x < meetingPoint.x) //While the two sides have not crossed over each other
        {
            //Moves both sides closer to each other
            P1Side.GetComponent <RectTransform>().anchoredPosition = Vector2.Lerp(p1Start, meetingPoint, increment);
            P2Side.GetComponent <RectTransform>().anchoredPosition = Vector2.Lerp(p2Start, -meetingPoint, increment);
            increment += Time.deltaTime * 0.25f;

            if (!handlingSmoke && increment > 0.8f) //If the smoke cloud is not on screen and P1 side has passed a certain point
            {
                fighters[0].StartCoroutine(HandleSmoke());
                handlingSmoke = true; //The smoke cloud is now on screen
            }
            yield return(null);
        }
    }
コード例 #8
0
 public static void SoloSound(SoundMaster master, bool solo)
 {
     hasSolo = solo;
     if (solo)
     {
         for (int i = 0; i < main.sounds.Count; i++)
         {
             main.sounds[i].Mute(mute: true);
         }
         if (level != null)
         {
             for (int j = 0; j < level.sounds.Count; j++)
             {
                 level.sounds[j].Mute(mute: true);
             }
         }
         if (menu != null)
         {
             for (int k = 0; k < menu.sounds.Count; k++)
             {
                 menu.sounds[k].Mute(mute: true);
             }
         }
         if (character != null)
         {
             for (int l = 0; l < character.sounds.Count; l++)
             {
                 character.sounds[l].Mute(mute: true);
             }
         }
         master.Mute(mute: false);
         return;
     }
     for (int m = 0; m < main.sounds.Count; m++)
     {
         main.sounds[m].Mute(mute: false);
     }
     if (level != null)
     {
         for (int n = 0; n < level.sounds.Count; n++)
         {
             level.sounds[n].Mute(mute: false);
         }
     }
     if (menu != null)
     {
         for (int num = 0; num < menu.sounds.Count; num++)
         {
             menu.sounds[num].Mute(mute: false);
         }
     }
     if (character != null)
     {
         for (int num2 = 0; num2 < character.sounds.Count; num2++)
         {
             character.sounds[num2].Mute(mute: false);
         }
     }
 }
コード例 #9
0
 public static void Deserialize(SoundMaster master, GrainState grainState)
 {
     master.SetGrainSlowVolume(grainState.slowVolume);
     master.SetGrainSlowTune(grainState.slowPitch);
     master.SetGrainFrequency(grainState.frequency);
     master.SetGrainFastJitter(grainState.fastJitter);
     master.SetGrainSlowJitter(grainState.slowJitter);
 }
コード例 #10
0
ファイル: UIMaster.cs プロジェクト: FungusSamurai/LittleWars
    public static void DisplayState(GamePhase phase, int player)
    {
        instance.phaseDisplayTexts[0].text = phase.ToString() + " Phase";
        instance.phaseDisplayTexts[1].text = "Player " + (player + 1);

        instance.pannelFaders[(int)UIPannels.Phase].StartCoroutine(FadePhase());

        SoundMaster.TurnTransition();
    }
コード例 #11
0
ファイル: SoundStatus.cs プロジェクト: henrydfb/tutisart2018
    public List <string> namenumber; //名前を保存し、その番号が親の配列番号になるはず

    void Awake()
    {
        soundmaster = GameObject.Find("SoundMaster_Obj").GetComponent <SoundMaster>();

        for (int i = 0; i < soundmaster.list_size.Length; i++)
        {
            namenumber.Add(soundmaster.list_size[i].Sound_Name);
        }
    }
コード例 #12
0
 public PlayerMaster()
 {
     currentTurn = 0;
     priorTurn   = 1;
     players     = new Player[2] {
         new Player(Quaternion.Euler(60, 180, 0)), new Player(Quaternion.Euler(55, 0, 0))
     };
     instance = this;
     soundM   = GameObject.Find("SoundMaster").GetComponent <SoundMaster>();
 }
コード例 #13
0
 public void SayDie(AudioClip playIfKilled = null)
 {
     //Debug.Log(name + " is dead");
     broadcastDeath = true;
     transform.SendMessage("Die", SendMessageOptions.DontRequireReceiver);
     if (playIfKilled != null)
     {
         SoundMaster.Play(playIfKilled, transform.position);
     }
 }
コード例 #14
0
    public static bool RepeatButton(Rect area, GUIContent c, float padding, string sound)
    {
        bool ret = GUI.RepeatButton(area, "");

        Label(area, c, padding, GUI.skin.button);
        if (ret)
        {
            SoundMaster.Play(sound);
        }
        return(ret);
    }
コード例 #15
0
 public static void EvaluateTileGroup(List <KeyValuePair <Unit, List <HexCell> > > paths)
 {
     foreach (KeyValuePair <Unit, List <HexCell> > pair in paths)
     {
         if (pair.Value.Count > 0)
         {
             target.StartCoroutine(FollowPath(pair.Value, pair.Key));
             SoundMaster.SelectUnit();
         }
     }
 }
コード例 #16
0
 public MoveMaster()
 {
     markerMat    = (Material)Resources.Load("Pictures/Materials/" + markerName);
     radiusMarker = null;
     timePressed  = 0.0f;
     uQue         = new List <Unit>();
     uSize        = 0;
     instance     = this;
     soundM       = GameObject.Find("SoundMaster").GetComponent <SoundMaster>();
     movingUnits  = 0;
 }
コード例 #17
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
コード例 #18
0
 public static bool Button(Rect r, GUIContent s, string snd)
 {
     if (GUI.Button(r, s))
     {
         SoundMaster.Play(snd); return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #19
0
 public void ups()
 {
     up = !up;
     if (up)
     {
         SoundMaster.TurnCannonOn();
     }
     else if (!up)
     {
         SoundMaster.TurnCannonOff();
     }
 }
コード例 #20
0
 public void downs()
 {
     down = !down;
     if (down)
     {
         SoundMaster.TurnCannonOn();
     }
     else if (!down)
     {
         SoundMaster.TurnCannonOff();
     }
 }
コード例 #21
0
 public void lefts()
 {
     left = !left;
     if (left)
     {
         SoundMaster.TurnCannonOn();
     }
     else if (!left)
     {
         SoundMaster.TurnCannonOff();
     }
 }
コード例 #22
0
 public void rights()
 {
     right = !right;
     if (right)
     {
         SoundMaster.TurnCannonOn();
     }
     else if (!right)
     {
         SoundMaster.TurnCannonOff();
     }
 }
コード例 #23
0
    public void SolveProblemsOnClick()
    {
        GameObject obj = GameObject.Find("SoundMaster");

        if (obj != null)
        {
            SoundMaster script = obj.GetComponent <SoundMaster> ();
            script.PlaySEStgSnd();
        }

        UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("DCMain");
    }
コード例 #24
0
    public static void SetTiles()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0) /*&& Events.GetComponent<Pause>().paused == false*/)
        {
            Ray        ray;
            RaycastHit hit;
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.transform.tag == "HexCell")
                {
                    HexCell h = hit.transform.gameObject.GetComponent <HexCell>();
                    if (PlayerMaster.CurrentPlayer.backLine.Contains(h))
                    {
                        int tSU = instance.toSpawnUnit;

                        if (MapMaster.Map[h.R, h.Q].Passable && tSU != -1)
                        {
                            if (instance.unitsUsed[tSU] > 0)
                            {
                                instance.unitsUsed[tSU]--;
                                instance.uoList.Add(new UnitOrder(h.r, h.q, tSU, (GameObject)GameObject.Instantiate(Resources.Load("prefabs/UnitImagePlane"), MapMaster.Map[h.R, h.Q].spawnPoint.transform.position + new Vector3(0.0f, 0.05f, 0.0f), Quaternion.Euler(0.0f, 180.0f * PlayerMaster.CurrentTurn, 0.0f))));
                                //aud.GetComponent<Audiomanager>().soundeffectplay(5);
                                SoundMaster.Deploy();

                                MapMaster.Map[h.R, h.Q].Passable = false;

                                instance.uoList[instance.uoList.Count - 1].icon.GetComponent <ImagePlaneTest>().SetUnitPicture(((UnitTypes)tSU).ToString(), PlayerMaster.CurrentTurn);
                            }
                        }
                        else if (!(MapMaster.Map[h.R, h.Q].Passable) && tSU == -1)
                        {
                            UnitOrder uO;
                            for (int i = 0; i < instance.uoList.Count; i++)
                            {
                                uO = instance.uoList[i];
                                if (h.r == uO.R && h.q == uO.Q)
                                {
                                    GameObject.Destroy(uO.icon);
                                    instance.unitsUsed[uO.unitType]++;
                                    h.Passable = true;
                                    instance.uoList.RemoveAt(i);
                                    break;
                                }
                            }
                        }
                        UIMaster.UpdateDeployAmount();
                    }
                }
            }
        }
    }
コード例 #25
0
    // Use this for initialization
    void Start()
    {
        GameObject obj = GameObject.Find("SoundMaster");

        if (obj != null)
        {
            SoundMaster script = obj.GetComponent <SoundMaster> ();
            if (script.BGMSource.isPlaying.Equals(false))
            {
                script.PlayBGM();
            }
        }
    }
コード例 #26
0
/*
    void DispModeSet()  // 画面モードセット
    {
        switch (DispMode)
        {
            case 1: // コルクモード
                OBJ_CARD_FIELD.gameObject.transform.Find("JuniorHigh_Cube/Image").gameObject.GetComponent<Image>() = 
                break;
            default:
                break;
        }

}
*/
    // -------------------------------------------------------------------------
    // Debug_MusicStop
    // デバッグ用 音の停止判定
    // -------------------------------------------------------------------------
    void Debug_MusicStop()
    {
        // BGMtoggleがfalseの場合は音を止める
        if (SETTING_DB.BGMToggle == false)
        {
            GameObject obj = GameObject.Find("SoundMaster");
            if (obj != null)
            {
                SoundMaster script = obj.GetComponent<SoundMaster>();
                script.StopBGM();
            }
        }
    }
コード例 #27
0
 void putFood()
 {
     if (foodProcessing == null && player.holding != null && myFoods.ContainsKey(player.holding) && !_timerStarted)
     {
         foodProcessing   = player.holding;
         player.holding   = null;
         _renderer.sprite = WithFood;
         StartCoroutine(startTimer());
     }
     else
     {
         SoundMaster.Play(SoundMaster.Type.Invalid);
     }
 }
コード例 #28
0
 public void RefreshSampleParameters(SoundLibrary.SerializedSample sample)
 {
     for (int i = 0; i < sounds.Count; i++)
     {
         SoundMaster soundMaster = sounds[i];
         if (soundMaster.master.soundSample != null && soundMaster.master.soundSample.name == sample.name)
         {
             for (int j = 0; j < soundMaster.linked.Count; j++)
             {
                 soundMaster.linked[j].RefreshSampleParameters();
             }
         }
     }
 }
コード例 #29
0
    public static bool AIMove(Unit u, HexCell h)
    {
        if (u != null && h.passable)
        {
            List <HexCell> path = HexStar.GetPath(u.CurrentHex, h, u.MoveSpeed);

            if (path.Count > 0)
            {
                u.StartCoroutine(FollowPath(path, u));
                SoundMaster.SelectUnit();
                return(true);
            }
        }
        return(false);
    }
コード例 #30
0
 void getFood()
 {
     if (player.holding == null)
     {
         SoundMaster.Play(SoundMaster.Type.Item);
         player.holding   = myFoods[foodProcessing];
         foodProcessing   = null;
         foodReady        = false;
         _renderer.sprite = WithoutFood;
     }
     else
     {
         SoundMaster.Play(SoundMaster.Type.Invalid);
     }
 }