private void IDFrameDataUI(int frameIndex, FrameType frameType) { FrameData frameData = GetFrameData(frameIndex); IDFrameData idFrameData = default; switch (frameType) { case FrameType.CommandAttack: idFrameData = frameData.commandAttackFrameData; break; case FrameType.CommandSkill: idFrameData = frameData.commandSkillFrameData; break; } IDData idData = idFrameData.idData; SpaceWithLabel(LabelEffectID); idData.id = TextField(idData.id); idFrameData.idData = idData; Controller.SetIDFrameData(frameIndex, frameType, idFrameData); bool isDelete = SpaceWithButton(BtnDelete); if (isDelete) { Controller.DeleteIDFrameData(frameIndex, frameType); } }
private static void LoadData() { if (currentData == null) { currentData = (IDData.saveKey + ".json").LoadData <IDData>(); if (currentData == null) { currentData = new IDData(); } } }
void Start() { //Get the camera if this is a player. if (gameObject.name.Contains("Player")) { IDData id = GetComponent <IDData>(); string s = id.PlayerID + " Camera"; GameObject o = GameObject.Find(s); Cam = o.transform; } Self = transform; GenData = WorldConstants.MatchWrapper.GetComponent <CreateLevel>(); }
void Awake() { //Cache references to other actor components. OwnerStats = GetComponent <Stats>(); ActorData = GetComponent <IDData>(); Animator = GetComponent <Animator>(); MeshController = GetComponent <SetMeshFor2D>(); Coll = GetComponent <BoxCollider>(); ColManager = GetComponent <CollisionManager>(); ActorProps = GetComponent <ActorProperties>(); PlayerProps = GetComponent <PlayerProperties>(); CameraConsts = WorldConstants.ConstantsOwner.GetComponent <CameraConstants>(); }
public GameObject CreatePlayerCamera(GameObject playerFollowing, int totalCameras) { //Create. GameObject g = (GameObject)Instantiate(PlayerCameraPrefab); Vector3 playPos = playerFollowing.transform.position; g.transform.position = new Vector3(playPos.x, playPos.y, g.transform.position.z); //Get components. IDData dat = playerFollowing.GetComponent <IDData>(); CameraFollowScript c = g.GetComponent <CameraFollowScript>(); //Set component data. g.name = dat.PlayerID + " Camera"; c.SetTarget(playerFollowing.GetComponent <StateMachine>()); //Set the view area. int i = dat.PlayerID - 1; switch (totalCameras) { case 1: break; case 2: c.camera.rect = new Rect(i * 0.5f, 0.0f, 0.5f, 1.0f); break; case 3: c.camera.rect = (i < 2 ? new Rect(i * 0.5f, 0.0f, 0.5f, 0.5f) : new Rect(0.25f, 0.5f, 0.5f, 0.5f)); break; case 4: c.camera.rect = (i < 2 ? new Rect(i * 0.5f, 0.0f, 0.5f, 0.5f) : new Rect((i - 2) * 0.5f, 0.5f, 0.5f, 0.5f)); break; default: throw new ArgumentOutOfRangeException("Must be one to four players!"); } //Set the view size. c.camera.orthographicSize = Screen.height * c.camera.rect.height * 0.5f * scale / SpriteHeight; ShowCullLayer(c.camera, "Background " + dat.PlayerID); return(g); }
public void SetID <Index>(Index[] data, PrimitiveType primitiveType) where Index : struct { Activate(); uint bufferID = RequestBuffer(idBufferBinding); GL.BindBuffer(BufferTarget.ElementArrayBuffer, bufferID); var type = typeof(Index); int elementBytes = Marshal.SizeOf(type); int bufferByteSize = data.Length * elementBytes; // set buffer data GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)bufferByteSize, data, BufferUsageHint.StaticDraw); //cleanup state Deactive(); GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0); //save data for draw call DrawElementsType drawElementsType = GetDrawElementsType(type); idData = new IDData(primitiveType, data.Length, drawElementsType); }
public GameObject CreatePlayer(Vector2 pos, byte id, byte input, Color team) { //TODO: Also take in the player's chosen character, input id, and set animation/stats. GameObject g = (GameObject)Instantiate(PlayerPrefab); g.transform.position = new Vector3(pos.x, pos.y, PlayerPrefab.transform.position.z); g.name = "Player"; IDData dat = g.GetComponent <IDData>(); dat.PlayerID = id; dat.Team = team; dat.SetRenderColor(); WorldConstants.MatchController.GetComponent <InputManager>().RegisterPlayerInput(id, input); WorldConstants.ColTracker.AddActor(g.GetComponent <StateMachine>()); CreateMinimapIcon(pos, Animations.MM_Player, team, MinimapIconScaling.Player, MinimapIconZPoses.Player).transform.parent = g.transform; return(g); }