상속: MonoBehaviour
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            mUnityPlayer = new UnityPlayer(Activity, this);
            //View view = inflater.Inflate(R.layout.fragment_unity, container, false);
            //this.frameLayoutForUnity = (FrameLayout)view.findViewById(R.id.frameLayoutForUnity);
            //this.frameLayoutForUnity.addView(mUnityPlayer.getView(),
            //        FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

            mUnityPlayer.RequestFocus();
            return(mUnityPlayer);
        }
예제 #2
0
    public void AddPlayerToList(GameObject playerObj, string playerName, int ID, Car car)
    {
        UnityPlayer p = new UnityPlayer
        {
            playerGameObject = playerObj,
            playerName       = playerName,
            playerID         = ID,
            playerCar        = car
        };

        playerList.Add(p);
    }
예제 #3
0
        public void AddControlsToUnityFrame()
        {
            FrameLayout layout = MUnityPlayer;

            {
                Button myButton = new Button(this);
                myButton.Text = "Show Main";
                myButton.SetX(10);
                myButton.SetY(500);
                myButton.Click += (_, __) =>
                {
                    ShowMainActivity("");
                };
            }

            {
                Button myButton = new Button(this);
                myButton.Text = "Send Msg";
                myButton.SetX(320);
                myButton.SetY(500);
                myButton.Click += (_, __) =>
                {
                    UnityPlayer.UnitySendMessage("Cube", "ChangeColor", "yellow");
                };
                layout.AddView(myButton, 300, 200);
            }

            {
                Button myButton = new Button(this);
                myButton.Text = "Unload";
                myButton.SetX(630);
                myButton.SetY(500);

                myButton.Click += (_, __) =>
                {
                    MUnityPlayer.Unload();
                };
                layout.AddView(myButton, 300, 200);
            }

            {
                Button myButton = new Button(this);
                myButton.Text = "Finish";
                myButton.SetX(630);
                myButton.SetY(800);

                myButton.Click += (_, __) =>
                {
                    Finish();
                };
                layout.AddView(myButton, 300, 200);
            }
        }
예제 #4
0
        protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code

        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                RequestWindowFeature(Android.Views.WindowFeatures.NoTitle);
                base.OnCreate(savedInstanceState);
                mUnityPlayer = new UnityPlayer(this);
                SetContentView(mUnityPlayer);
                mUnityPlayer.RequestFocus();
                Timer();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #5
0
    void firstBombTarget()
    {
        int randomInt = Random.Range(0, playerList.Count);

        UnityPlayer target = playerList[randomInt];

        byte evCode = 3;                                                                                              // Custom Event 3: Used as "FirstBombHolder" event

        object[]          content           = new object[] { (short)target.playerGameObject.GetPhotonView().ViewID }; // Current bomb holder, random new target choice, and if the car is dead
        RaiseEventOptions raiseEventOptions = new RaiseEventOptions {
            Receivers = ReceiverGroup.All
        };
        SendOptions sendOptions = new SendOptions {
            Reliability = true
        };

        PhotonNetwork.RaiseEvent(evCode, content, raiseEventOptions, sendOptions);
    }
예제 #6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Button btn1 = new Button(this)
            {
                Text = "Зелёный"
            };

            btn1.SetY(0);
            btn1.SetX(10);
            btn1.Click += (s, e) => UnityPlayer.UnitySendMessage("Cube", "SetColorGreen", "");
            Button btn2 = new Button(this)
            {
                Text = "Красный"
            };

            btn2.SetY(200);
            btn2.SetX(10);
            btn2.Click += (s, e) => UnityPlayer.UnitySendMessage("Cube", "SetColorRed", "");
            UnityFrameLayout.AddView(btn1, 500, 100);
            UnityFrameLayout.AddView(btn2, 500, 100);
        }
예제 #7
0
 public void MovePlayerToLocation(UnityPlayer player, int x, int y)
 {
     _roundProcessor.MovePlayerToLocation(player, x, y);
 }
예제 #8
0
 public void PlantBomb(UnityPlayer player)
 {
     _roundProcessor.AddPlayerCommand(player, new PlaceBombCommand());
 }
예제 #9
0
 public void TriggerBomb(UnityPlayer player)
 {
     _roundProcessor.AddPlayerCommand(player, new TriggerBombCommand());
 }
 public void UnitySendMessage(string gameObject, string function, string param)
 {
     UnityPlayer.UnitySendMessage(gameObject, function, param);
 }