예제 #1
0
        public void Reset()
        {
            IResetable channelModule = (IResetable)ChannelModule;

            channelModule.Reset();
            VolumeModule.Reset();
            InvokeEventStatusChanged(String.Format("{0}:\t \"{1}\" has reseted.", this.GetType(), name));
        }
예제 #2
0
 public void Sleep(int miliseconds, WarriorState state, IResetable resetable)
 {
     Thread.Sleep(miliseconds);
     if (state.State != State.Interrupted)
     {
         resetable.Reset();
     }
 }
예제 #3
0
    public void OnRestart()
    {
        foreach (GameObject item in ItemsToReset)
        {
            item.SetActive(true);
            IResetable resetable = item.GetComponentInChildren <IResetable>();
            if (resetable != null)
            {
                resetable.Reset();
            }
        }
        ScoreManager.Instance.SetScore(this);
        TimeManager.Instance.Continue();

        player.transform.parent   = null;
        player.transform.position = new Vector3(m_RebirthPos.x, m_RebirthPos.y, 0);         //回归初始位置
        player.transform.rotation = new Quaternion(0, 0, 0, 0);                             //初始旋转角
        player.GetComponent <Rigidbody2D>().velocity    = Vector3.zero;                     //质心速度清零
        player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll; //角速度清零
        player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.None;
        player.GetComponent <Rigidbody2D>().isKinematic = false;
        m_deathing = false;
    }
예제 #4
0
 private void GoTwoWordsCommands()
 {
     if (CheckDeviseType(command[0]))
     {
         if ("create" == command[1].ToLower())
         {
             CreateNewDevice();
         }
         else
         {
             command = null;
             throw new ArgumentException("Command is wrong");
         }
     }
     else if ("delete" == command[1].ToLower())
     {
         if (deviceList.ContainsKey(command[0]))
         {
             deviceList.Remove(command[0]);
             Console.WriteLine("Device {0} has been removed", command[0]);
         }
         else
         {
             throw new ArgumentException("Wrong device name");
         }
     }
     else if ("on" == command[1].ToLower())
     {
         IEnablable device = deviceList[command[0]];
         device.On();
     }
     else if ("off" == command[1].ToLower())
     {
         IEnablable device = deviceList[command[0]];
         device.Off();
     }
     else if ("defrost" == command[1].ToLower())
     {
         if (deviceList[command[0]] is IDefrostable)
         {
             IDefrostable device = (IDefrostable)deviceList[command[0]];
             device.Defrost();
         }
         else
         {
             throw new ArgumentException("Wrong device");
         }
     }
     else if ("reset" == command[1].ToLower())
     {
         if (deviceList[command[0]] is IResetable)
         {
             IResetable device = (IResetable)deviceList[command[0]];
             device.Reset();
         }
         else
         {
             throw new ArgumentException("Wrong device");
         }
     }
     else if ("write" == command[1].ToLower())
     {
         if (deviceList[command[0]] is IGetChannelList)
         {
             IGetChannelList device      = (IGetChannelList)deviceList[command[0]];
             List <string>   channelList = device.GetChannelList();
             Console.WriteLine("Channel list of {0}", command[0]);
             foreach (string item in channelList)
             {
                 Console.WriteLine(item);
             }
             Console.ReadLine();
         }
         else
         {
             throw new ArgumentException("Wrong device");
         }
     }
     else
     {
         throw new ArgumentException("Wrong command");
     }
 }