~saurabhs/bomberman

ae1dc88ce246a3d50948b9b4679281e77065648c — Saurabh S 4 years ago 7f5f59c
Added Single player mode
3 files changed, 207 insertions(+), 13 deletions(-)

M Assets/Scenes/menu.unity
M Assets/Scripts/Common/Constants.cs
M Assets/Scripts/Core/Menu.cs
M Assets/Scenes/menu.unity => Assets/Scenes/menu.unity +199 -7
@@ 77,15 77,18 @@ LightmapSettings:
    m_PVRDirectSampleCount: 32
    m_PVRSampleCount: 500
    m_PVRBounces: 2
    m_PVRFiltering: 0
    m_PVRFilterTypeDirect: 0
    m_PVRFilterTypeIndirect: 0
    m_PVRFilterTypeAO: 0
    m_PVRFilteringMode: 1
    m_PVRCulling: 1
    m_PVRFilteringGaussRadiusDirect: 1
    m_PVRFilteringGaussRadiusIndirect: 5
    m_PVRFilteringGaussRadiusAO: 2
    m_PVRFilteringAtrousColorSigma: 1
    m_PVRFilteringAtrousNormalSigma: 1
    m_PVRFilteringAtrousPositionSigma: 1
    m_PVRFilteringAtrousPositionSigmaDirect: 0.5
    m_PVRFilteringAtrousPositionSigmaIndirect: 2
    m_PVRFilteringAtrousPositionSigmaAO: 1
    m_ShowResolutionOverlay: 1
  m_LightingDataAsset: {fileID: 0}
  m_UseShadowmask: 1
--- !u!196 &4


@@ 107,6 110,8 @@ NavMeshSettings:
    manualTileSize: 0
    tileSize: 256
    accuratePlacement: 0
    debug:
      m_Flags: 0
  m_NavMeshData: {fileID: 0}
--- !u!1 &123827934
GameObject:


@@ 253,11 258,11 @@ Camera:
  m_TargetEye: 3
  m_HDR: 1
  m_AllowMSAA: 1
  m_AllowDynamicResolution: 0
  m_ForceIntoRT: 0
  m_OcclusionCulling: 1
  m_StereoConvergence: 10
  m_StereoSeparation: 0.022
  m_StereoMirrorMode: 0
--- !u!4 &471353507
Transform:
  m_ObjectHideFlags: 0


@@ 300,6 305,7 @@ RectTransform:
  m_Children:
  - {fileID: 1218235131}
  - {fileID: 1877235515}
  - {fileID: 1871855984}
  m_Father: {fileID: 949591604}
  m_RootOrder: 0
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}


@@ 512,7 518,8 @@ MonoBehaviour:
  m_Script: {fileID: 11500000, guid: 60acae7590a103745a950154d0e0132b, type: 3}
  m_Name: 
  m_EditorClassIdentifier: 
  playButton: {fileID: 1877235516}
  playSoloButton: {fileID: 1871855985}
  playCoopButton: {fileID: 1877235516}
--- !u!1 &1218235130
GameObject:
  m_ObjectHideFlags: 0


@@ 649,6 656,191 @@ Transform:
  m_Father: {fileID: 0}
  m_RootOrder: 3
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1601428059
GameObject:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  serializedVersion: 5
  m_Component:
  - component: {fileID: 1601428060}
  - component: {fileID: 1601428062}
  - component: {fileID: 1601428061}
  m_Layer: 5
  m_Name: Text
  m_TagString: Untagged
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_StaticEditorFlags: 0
  m_IsActive: 1
--- !u!224 &1601428060
RectTransform:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 1601428059}
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
  m_LocalPosition: {x: 0, y: 0, z: 0}
  m_LocalScale: {x: 1, y: 1, z: 1}
  m_Children: []
  m_Father: {fileID: 1871855984}
  m_RootOrder: 0
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
  m_AnchorMin: {x: 0, y: 0}
  m_AnchorMax: {x: 1, y: 1}
  m_AnchoredPosition: {x: 0, y: 0}
  m_SizeDelta: {x: 0, y: 0}
  m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1601428061
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 1601428059}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
  m_Name: 
  m_EditorClassIdentifier: 
  m_Material: {fileID: 0}
  m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
  m_RaycastTarget: 1
  m_OnCullStateChanged:
    m_PersistentCalls:
      m_Calls: []
    m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
      Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  m_FontData:
    m_Font: {fileID: 12800000, guid: a2994aad33f4c334dad7a7204496f23d, type: 3}
    m_FontSize: 28
    m_FontStyle: 0
    m_BestFit: 0
    m_MinSize: 2
    m_MaxSize: 40
    m_Alignment: 4
    m_AlignByGeometry: 0
    m_RichText: 1
    m_HorizontalOverflow: 0
    m_VerticalOverflow: 0
    m_LineSpacing: 1
  m_Text: PLAY SOLO
--- !u!222 &1601428062
CanvasRenderer:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 1601428059}
--- !u!1 &1871855983
GameObject:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  serializedVersion: 5
  m_Component:
  - component: {fileID: 1871855984}
  - component: {fileID: 1871855987}
  - component: {fileID: 1871855986}
  - component: {fileID: 1871855985}
  m_Layer: 5
  m_Name: playSolo
  m_TagString: Untagged
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_StaticEditorFlags: 0
  m_IsActive: 1
--- !u!224 &1871855984
RectTransform:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 1871855983}
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
  m_LocalPosition: {x: 0, y: 0, z: 0}
  m_LocalScale: {x: 1, y: 1, z: 1}
  m_Children:
  - {fileID: 1601428060}
  m_Father: {fileID: 915737758}
  m_RootOrder: 2
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
  m_AnchorMin: {x: 0.5, y: 0.5}
  m_AnchorMax: {x: 0.5, y: 0.5}
  m_AnchoredPosition: {x: 0, y: -61}
  m_SizeDelta: {x: 200, y: 60}
  m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1871855985
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 1871855983}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
  m_Name: 
  m_EditorClassIdentifier: 
  m_Navigation:
    m_Mode: 3
    m_SelectOnUp: {fileID: 0}
    m_SelectOnDown: {fileID: 0}
    m_SelectOnLeft: {fileID: 0}
    m_SelectOnRight: {fileID: 0}
  m_Transition: 1
  m_Colors:
    m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
    m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
    m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
    m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
    m_ColorMultiplier: 1
    m_FadeDuration: 0.1
  m_SpriteState:
    m_HighlightedSprite: {fileID: 0}
    m_PressedSprite: {fileID: 0}
    m_DisabledSprite: {fileID: 0}
  m_AnimationTriggers:
    m_NormalTrigger: Normal
    m_HighlightedTrigger: Highlighted
    m_PressedTrigger: Pressed
    m_DisabledTrigger: Disabled
  m_Interactable: 1
  m_TargetGraphic: {fileID: 1871855986}
  m_OnClick:
    m_PersistentCalls:
      m_Calls: []
    m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
      Culture=neutral, PublicKeyToken=null
--- !u!114 &1871855986
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 1871855983}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
  m_Name: 
  m_EditorClassIdentifier: 
  m_Material: {fileID: 0}
  m_Color: {r: 1, g: 1, b: 1, a: 1}
  m_RaycastTarget: 1
  m_OnCullStateChanged:
    m_PersistentCalls:
      m_Calls: []
    m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
      Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
  m_Type: 1
  m_PreserveAspect: 0
  m_FillCenter: 1
  m_FillMethod: 4
  m_FillAmount: 1
  m_FillClockwise: 1
  m_FillOrigin: 0
--- !u!222 &1871855987
CanvasRenderer:
  m_ObjectHideFlags: 0
  m_PrefabParentObject: {fileID: 0}
  m_PrefabInternal: {fileID: 0}
  m_GameObject: {fileID: 1871855983}
--- !u!1 &1877235514
GameObject:
  m_ObjectHideFlags: 0


@@ 661,7 853,7 @@ GameObject:
  - component: {fileID: 1877235517}
  - component: {fileID: 1877235516}
  m_Layer: 5
  m_Name: play
  m_Name: playCoop
  m_TagString: Untagged
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0

M Assets/Scripts/Common/Constants.cs => Assets/Scripts/Common/Constants.cs +2 -2
@@ 117,8 117,8 @@ namespace Bomberman
        public static int PLAYER2_ID = 4;
        public static int ENEMY_ID = 5;

        public static int SINGLEPLAYER_ID = 100;
        public static int COOP_ID = 101;
        public static byte SINGLEPLAYER_ID = 100;
        public static byte COOP_ID = 101;

        public static string GAME_TYPE = "GAME_TYPE";
        public static string GAME_RESULT = "GAME_RESULT";

M Assets/Scripts/Core/Menu.cs => Assets/Scripts/Core/Menu.cs +6 -4
@@ 5,16 5,18 @@ namespace Bomberman
{
    public class Menu : MonoBehaviour
    {
        public Button playButton;
        public Button playSoloButton;
        public Button playCoopButton;

        private void Start()
        {
            playButton.onClick.AddListener( () => StartGame() );
            playSoloButton.onClick.AddListener( () => StartGame( Constants.SINGLEPLAYER_ID ) );
            playCoopButton.onClick.AddListener( () => StartGame( Constants.COOP_ID ) );
        }

        private void StartGame()
        private void StartGame( byte playType )
        {
            PlayerPrefs.SetInt( Constants.GAME_TYPE, Constants.COOP_ID );
            PlayerPrefs.SetInt( Constants.GAME_TYPE, ( int )playType );
            UnityEngine.SceneManagement.SceneManager.LoadScene( $"map0{Random.Range( 1, 3 )}" );
        }
    }