예제 #1
0
    // Use this for initialization
    void Start()
    {
        Limbs  = new LinkedList();
        player = GameObject.FindGameObjectWithTag("Player");
        Debug.Log(player.transform.position);
        offSet        = player.transform.position + (player.transform.forward * 985.0f);
        follower      = GameObject.FindGameObjectWithTag("follower");
        Wreck         = GameObject.Find("BreakTerrain");
        exit          = GameObject.Find("Exit");
        back1         = GameObject.Find("Background");
        breakable     = GameObject.FindGameObjectWithTag("breakable");
        ControlScript = player.GetComponent <SwitchControl>();
        //find all objects with tags "leg" and "arm"
        Legs           = GameObject.FindGameObjectsWithTag("leg");
        Arms           = GameObject.FindGameObjectsWithTag("arm");
        playerAnimator = player.GetComponent <Animator>();
        sounds         = player.GetComponent <Sound>();

        Levels = new string[] { "AlexFerr2DLevel", "Showcase" };
        for (int i = 0; i < Legs.Length; i++)
        {
            Limbs.append(Legs[i]);
        }

        for (int i = 0; i < Arms.Length; i++)
        {
            Limbs.append(Arms[i]);
        }
    }
예제 #2
0
 //Se puede hacer con Raycast
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Switch"))
     {
         currentSwitch = other.GetComponent <SwitchControl>();
     }
 }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     player         = GameObject.Find("Player");
     rangeIndicator = GameObject.Find("RangeIndicator");
     ControlScript  = player.GetComponent <SwitchControl>();
     target         = ControlScript.ClosestLimb;
 }
예제 #4
0
 public static IObservable <(bool?isChecked, object value)> SelectToggles(this SwitchControl switchView)
 {
     return(Observable.FromEventPattern <SwitchControl.ToggleEventHandler, SwitchControl.ToggleEventArgs>(
                a => switchView.ButtonToggle += a,
                a => switchView.ButtonToggle -= a)
            .Select(a => (a.EventArgs.IsChecked, a.EventArgs.Key)));
 }
예제 #5
0
 private void OnTriggerExit(Collider other)
 {
     if (other.CompareTag("Switch"))
     {
         currentSwitch = null;
     }
 }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        Limbs = new LinkedList();
        player = GameObject.FindGameObjectWithTag("Player");
        Debug.Log(player.transform.position);
        offSet = player.transform.position + (player.transform.forward * 985.0f);
        follower = GameObject.FindGameObjectWithTag("follower");
        Wreck = GameObject.Find("BreakTerrain");
		exit = GameObject.Find("Exit");
        back1 = GameObject.Find("Background");
        breakable = GameObject.FindGameObjectWithTag("breakable");
        ControlScript = player.GetComponent<SwitchControl>();
        //find all objects with tags "leg" and "arm"
        Legs = GameObject.FindGameObjectsWithTag("leg");
        Arms = GameObject.FindGameObjectsWithTag("arm");
        playerAnimator = player.GetComponent<Animator>();
        sounds = player.GetComponent<Sound>();

        Levels = new string[]{"AlexFerr2DLevel", "Showcase"};
        for (int i = 0; i < Legs.Length; i++) 
        {
            Limbs.append(Legs[i]);
        }

        for (int i = 0; i < Arms.Length; i++) 
        {
            Limbs.append(Arms[i]);
        }
    }
예제 #7
0
파일: LevelManager.cs 프로젝트: Rebind/Alex
    // Use this for initialization
    void Start()
    {
        Limbs = new LinkedList();

        player = GameObject.Find("Player");
        Wreck = GameObject.Find("BreakTerrain");
		exit = GameObject.Find("Exit");
        breakable = GameObject.FindGameObjectWithTag("breakable");
        ControlScript = player.GetComponent<SwitchControl>();
        //find all objects with tags "leg" and "arm"
        Legs = GameObject.FindGameObjectsWithTag("leg");
        Arms = GameObject.FindGameObjectsWithTag("arm");
        playerAnimator = player.GetComponent<Animator>();

		Levels = new string[]{"AlexFerr2DLevel", "Showcase"};
        for (int i = 0; i < Legs.Length; i++) 
        {
            Limbs.append(Legs[i]);
        }

        for (int i = 0; i < Arms.Length; i++) 
        {
            Limbs.append(Arms[i]);
        }
    }
예제 #8
0
 // Use this for initialization
 void Start()
 {
     SC = this;
     _Teleport.SetActive(true);
     _Retricle.SetActive(false);
     _Laser.SetActive(false);
     Mover.SetActive(false);
 }
예제 #9
0
 void OnTriggerExit(Collider other)
 {
     if (other.CompareTag("Switch"))
     {
         currentSwitch          = null;
         panelIndicator.enabled = false;
         panelIndicator.GetComponentInChildren <Text>().enabled = false;
     }
 }
예제 #10
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Switch"))
     {
         currentSwitch          = other.GetComponent <SwitchControl>();
         panelIndicator.enabled = true;
         panelIndicator.GetComponentInChildren <Text>().enabled = true;
     }
 }
예제 #11
0
파일: AcidSound.cs 프로젝트: Rebind/Master
	// Use this for initialization
	void Start () {
		tmp = GameObject.Find("Player");
		ControlScript = tmp.GetComponent<SwitchControl>();
		target = ControlScript.inControl;
		acidsound = this.GetComponent<AudioSource>();
		UIManager = GameObject.Find("UIManager");
		UIScript = UIManager.GetComponent<UIManager>();
		//set all acid volume to 0 at start of the level
		//acidsound.volume = 0f;
	}
예제 #12
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Switch"))
     {
         currentSwitch = other.GetComponent <SwitchControl>();
     }
     else if (other.CompareTag("MovingPlatform"))
     {
         movingPlatform = other.transform;
     }
 }
예제 #13
0
파일: AcidSound.cs 프로젝트: Rebind/Master
 // Use this for initialization
 void Start()
 {
     tmp           = GameObject.Find("Player");
     ControlScript = tmp.GetComponent <SwitchControl>();
     target        = ControlScript.inControl;
     acidsound     = this.GetComponent <AudioSource>();
     UIManager     = GameObject.Find("UIManager");
     UIScript      = UIManager.GetComponent <UIManager>();
     //set all acid volume to 0 at start of the level
     //acidsound.volume = 0f;
 }
예제 #14
0
    public override void Invoke()
    {
        //Besides loading another scene we need to nullify all scene local subscriptions
        //These will be loaded again as soon as we enter the scene
        //If you come across this section, Martin, this would probably be a good use case for UnityEvents
        InputManager.NullifyButtonPressed();
        SwitchControl.NullifySwitched();

        InputManager.state = InputState.Title;
        Time.timeScale     = 1f;
        Application.LoadLevel(0);
    }
예제 #15
0
        public override void Draw(ObservableCollection <UIElement> list, double cellHeight, double cellWidth, double currentWidth, Point point1, Point point2, Element element)
        {
            SwitchControl switchControl = new SwitchControl(element, currentWidth);

            Canvas.SetLeft(switchControl, point2.X - (currentWidth) / 2 - currentWidth - 2);
            Canvas.SetTop(switchControl, point2.Y - (cellHeight / 3) - (currentWidth) / 2);
            Canvas.SetZIndex(switchControl, 5);

            //switchControl.Button.Command = PropertiesCommand;
            switchControl.Button.CommandParameter = element.ElementGID;
            switchControl.ButtonCanvas.ToolTip    = element.MRID;

            list.Add(switchControl);
        }
    public void SwitchOn(object sender, ImageClickEventArgs e)
    {
        byte[] data = new byte[1024];
        //string input, stringData;
        IPEndPoint ipep   = new IPEndPoint(IPAddress.Parse("192.168.0.151"), 234);
        Socket     server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

        Random Statreq = new Random();
        int    index   = Statreq.Next(0, 5);


        SwitchControl swt = new SwitchControl
        {
            Request   = "SwitchControl",
            RequestID = index.ToString(),
            Controls  = new Control[] { new Control()
                                        {
                                            ID = "37", StatusValue = "255"
                                        } },

            Version     = "1501603666",
            RequestedBy = "DefaultUser"
        };

        string output = JsonConvert.SerializeObject(swt);

        data = Encoding.ASCII.GetBytes(output);
        Console.WriteLine(Encoding.ASCII.GetString(data));

        Test.InnerHtml = "data";
        server.SendTo(data, data.Length, SocketFlags.None, ipep);

        sender = new IPEndPoint(IPAddress.Any, 0);
        EndPoint Remote = (EndPoint)(sender);

        data = new byte[1024];

        int recv = server.ReceiveFrom(data, ref Remote);

        Console.WriteLine("Message received from {0}:", Remote.ToString());

        Console.WriteLine(recv);

        Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));
        LightStatus.InnerHtml = Server.HtmlEncode(Encoding.ASCII.GetString(data, 0, recv));
    }
예제 #17
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Ret != 0)
            {
                hash ^= Ret.GetHashCode();
            }
            if (mainVersion_ != null)
            {
                hash ^= MainVersion.GetHashCode();
            }
            if (hotVersion_ != null)
            {
                hash ^= HotVersion.GetHashCode();
            }
            hash ^= cacheVersion_.GetHashCode();
            hash ^= gameServerInfo_.GetHashCode();
            if (imgServerInfo_ != null)
            {
                hash ^= ImgServerInfo.GetHashCode();
            }
            if (reserveImgServerInfo_ != null)
            {
                hash ^= ReserveImgServerInfo.GetHashCode();
            }
            if (matchingServerInfo_ != null)
            {
                hash ^= MatchingServerInfo.GetHashCode();
            }
            hash ^= notice_.GetHashCode();
            if (switchControl_ != null)
            {
                hash ^= SwitchControl.GetHashCode();
            }
            if (DisclaimerVersion != 0)
            {
                hash ^= DisclaimerVersion.GetHashCode();
            }
            return(hash);
        }
예제 #18
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Switch> e)
        {
            base.OnElementChanged(e);

            if (this.Control != null)
            {
                ctrl       = (SwitchControl)e.NewElement;
                trueColor  = ctrl.TrueColor;
                falseColor = ctrl.FalseColor;

                if (this.Control.Checked)
                {
                    this.Control.TrackDrawable.SetColorFilter(trueColor.ToAndroid(), PorterDuff.Mode.Multiply);
                    this.Control.ThumbDrawable.SetColorFilter(trueColor.ToAndroid(), PorterDuff.Mode.Multiply);
                }
                else
                {
                    this.Control.TrackDrawable.SetColorFilter(falseColor.ToAndroid(), PorterDuff.Mode.Multiply);
                    this.Control.ThumbDrawable.SetColorFilter(falseColor.ToAndroid(), PorterDuff.Mode.Multiply);
                }

                this.Control.CheckedChange += this.OnCheckedChange;
            }
        }
예제 #19
0
	// Use this for initialization
	void Start () {
		tmp = GameObject.Find("Player");
		ControlScript = tmp.GetComponent<SwitchControl>();
		target = ControlScript.inControl;
	}
예제 #20
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        //climbing ladders and ropes
        if ((collision.gameObject.CompareTag("Ladder")) || (collision.gameObject.CompareTag("Rope") && hasGem == false))
        {
            climbspeed      = 3;
            rb.gravityScale = 0;
            rb.velocity     = new Vector2(rb.velocity.x, moveY * climbspeed);
        }
        else if (collision.gameObject.CompareTag("Rope") && hasGem)
        {
            climbspeed      = 1.5f;
            rb.gravityScale = 0;
            rb.velocity     = new Vector2(rb.velocity.x, moveY * climbspeed);
        }

        //interaction with gem
        if (collision.gameObject.CompareTag("Gem"))
        {
            atGem = true;
            if (interactCharge >= 0.5f)
            {
                Debug.Log("gem");
                if (hasGem == false)
                {
                    GemControl gemScript = collision.gameObject.GetComponent <GemControl>();
                    if (gemScript.isHeld == false)
                    {
                        hasGem           = true;
                        gemScript.isHeld = true;
                        gemScript.holder = gameObject;
                    }
                }
                else
                {
                    hasGem = false;
                    GemControl gemScript = collision.gameObject.GetComponent <GemControl>();
                    gemScript.isHeld = false;
                }
                interactCharge = 0;
            }
        }
        //interaction with cannon
        else if (collision.gameObject.CompareTag("Cannon"))
        {
            atCannon = true;
            if (interactCharge >= 0.5f)
            {
                Debug.Log("cannon");
                CannonControl cc = collision.gameObject.GetComponent <CannonControl>();
                cc.status      = 1;
                interactCharge = 0;
            }
        }
        //interaction with switch
        if (collision.gameObject.CompareTag("Switch"))
        {
            atSwitch = true;
            if (interactCharge >= 0.5f)
            {
                Debug.Log("switch");
                SwitchControl sc = collision.gameObject.GetComponent <SwitchControl>();
                sc.switchflip  = 1;
                interactCharge = 0;
            }
        }
        //interaction with supply
        if (collision.gameObject.CompareTag("Supply"))
        {
            atSupply = true;
            if (interactCharge >= 0.5f)
            {
                if (!hasBomb)
                {
                    Debug.Log("supply");
                    hasBomb = true;
                    mybomb.SetActive(true);
                }
                interactCharge = 0;
            }
        }
    }
예제 #21
0
        private void btnSendToSwitch_Click(object sender, EventArgs e)
        {
            if (users.Tables[0].Rows.Count == 0)
            {
                FormTools.ErrBox("Please add some phones, before connecting!", "Send Phones");
                return;
            }
            startWorkGUI();
            StringBuilder sb = new StringBuilder();
            foreach (DataRow row in users.Tables[0].Rows)
            {
                string phone = (string)row["PhoneNumber"];
                bool enabled = (bool) row["Enabled"];
                phone = RemoveNonDigitsFromString(phone).Trim();
                if (enabled && phone.Length > 0)
                    sb.Append(phone + " ");
            }
            phones = sb.ToString();

            switch_ = SwitchControl.TO;
            bgwSwitch.RunWorkerAsync();
        }
예제 #22
0
 private void btnLoadFromSwitch_Click(object sender, EventArgs e)
 {
     startWorkGUI();
     switch_ = SwitchControl.FROM;
     phones = string.Empty;
     bgwSwitch.RunWorkerAsync();
 }
예제 #23
0
 private void bgwSwitch_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     switch (switch_)
     {
         case SwitchControl.FROM:
             this.users.Clear();
             ParseResult();
             toolStripStatus.Text = "All data loaded!";
             break;
         case SwitchControl.TO:
             if (sendDataResult == false)
             {
                 toolStripStatus.Text = "Switch updated failed!";
                 FormTools.ErrBox("Switch updated failed!", "Switch Update Status");
             }
             else
                 toolStripStatus.Text = "Switch updated successfully!";
             break;
         default:
             break;
     }
     switch_ = SwitchControl.NA;
     stopWorkGUI();
 }
예제 #24
0
	// Use this for initialization
	void Start () {
		player = GameObject.Find("Player");
		rangeIndicator = GameObject.Find("RangeIndicator");
		ControlScript = player.GetComponent<SwitchControl>();
		target = ControlScript.ClosestLimb;
	}
예제 #25
0
 // Use this for initialization
 void Start()
 {
     tmp           = GameObject.Find("Player");
     ControlScript = tmp.GetComponent <SwitchControl>();
     target        = ControlScript.inControl;
 }
예제 #26
0
 public void MergeFrom(GameServerRes other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Ret != 0)
     {
         Ret = other.Ret;
     }
     if (other.mainVersion_ != null)
     {
         if (mainVersion_ == null)
         {
             mainVersion_ = new global::Com.Proto.Server.MainVersionPB();
         }
         MainVersion.MergeFrom(other.MainVersion);
     }
     if (other.hotVersion_ != null)
     {
         if (hotVersion_ == null)
         {
             hotVersion_ = new global::Com.Proto.Server.HotVersionPB();
         }
         HotVersion.MergeFrom(other.HotVersion);
     }
     cacheVersion_.Add(other.cacheVersion_);
     gameServerInfo_.Add(other.gameServerInfo_);
     if (other.imgServerInfo_ != null)
     {
         if (imgServerInfo_ == null)
         {
             imgServerInfo_ = new global::Com.Proto.Server.ImgServerInfoPB();
         }
         ImgServerInfo.MergeFrom(other.ImgServerInfo);
     }
     if (other.reserveImgServerInfo_ != null)
     {
         if (reserveImgServerInfo_ == null)
         {
             reserveImgServerInfo_ = new global::Com.Proto.Server.ImgServerInfoPB();
         }
         ReserveImgServerInfo.MergeFrom(other.ReserveImgServerInfo);
     }
     if (other.matchingServerInfo_ != null)
     {
         if (matchingServerInfo_ == null)
         {
             matchingServerInfo_ = new global::Com.Proto.Server.MatchingServiceInfoPB();
         }
         MatchingServerInfo.MergeFrom(other.MatchingServerInfo);
     }
     notice_.Add(other.notice_);
     if (other.switchControl_ != null)
     {
         if (switchControl_ == null)
         {
             switchControl_ = new global::Com.Proto.Server.SwitchControlPB();
         }
         SwitchControl.MergeFrom(other.SwitchControl);
     }
     if (other.DisclaimerVersion != 0)
     {
         DisclaimerVersion = other.DisclaimerVersion;
     }
 }