This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return Region3i.createFromMinMax(new Vector3i(centerBasePosition.x() - LASUtils.BASE_EXTENT, centerBasePosition.y(), centerBasePosition.z() - LASUtils.BASE_EXTENT), | |
new Vector3i(centerBasePosition.x() + LASUtils.BASE_EXTENT, centerBasePosition.y(), centerBasePosition.z() + LASUtils.BASE_EXTENT)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (Vector3i baseBlockPosition : baseRegion) { | |
if (chunkRegion.getRegion().encompasses(baseBlockPosition) && baseBlockPosition.x > 0) { | |
chunk.setBlock(ChunkMath.calcBlockPos(baseBlockPosition), redBaseStone); | |
} else if (chunkRegion.getRegion().encompasses(baseBlockPosition)) { | |
chunk.setBlock(ChunkMath.calcBlockPos(baseBlockPosition), blackBaseStone); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String setPlayerTeamToTeleporterTeam(EntityRef player, EntityRef teleporter) { | |
LASTeamComponent teleporterTeamComponent = teleporter.getComponent(LASTeamComponent.class); | |
LASTeamComponent playerTeamComponent = player.getComponent(LASTeamComponent.class); | |
playerTeamComponent.team = teleporterTeamComponent.team; | |
player.saveComponent(playerTeamComponent); | |
return playerTeamComponent.team; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void giveFlagToPlayer(EntityRef flag, EntityRef player) { | |
BlockComponent blockComponent = flag.getComponent(BlockComponent.class); | |
LASTeamComponent flagTeamComponent = flag.getComponent(LASTeamComponent.class); | |
BlockItemFactory blockFactory = new BlockItemFactory(entityManager); | |
inventoryManager.giveItem(player, EntityRef.NULL, blockFactory.newInstance(blockManager.getBlockFamily(LASUtils.getFlagURI(flagTeamComponent.team)))); | |
worldProvider.setBlock(blockComponent.getPosition(), blockManager.getBlock(BlockManager.AIR_ID)); | |
flag.destroy(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int inventorySize = inventoryManager.getNumSlots(targetPlayer); | |
for (int slotNumber = 0; slotNumber <= inventorySize; slotNumber++) { | |
EntityRef inventorySlot = inventoryManager.getItemInSlot(targetPlayer, slotNumber); | |
if (inventorySlot.hasComponent(BlockItemComponent.class)) { | |
if (inventorySlot.getComponent(BlockItemComponent.class).blockFamily.getURI().toString().equals(flagTeam)) { | |
flagSlot = inventorySlot; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void incrementScore(LASTeamComponent baseTeamComponent) { | |
if (baseTeamComponent.team.equals(LASUtils.RED_TEAM)) { | |
redScore++; | |
// Send event to clients to update their Score UI | |
sendEventToClients(new ScoreUpdateFromServerEvent(LASUtils.RED_TEAM, redScore)); | |
return; | |
} | |
if (baseTeamComponent.team.equals(LASUtils.BLACK_TEAM)) { | |
blackScore++; | |
// Send event to clients to update their Score UI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ReceiveEvent | |
public void onScoreUpdateFromServer(ScoreUpdateFromServerEvent event, EntityRef entity) { | |
String team = event.team; | |
if (team.equals(LASUtils.RED_TEAM)) { | |
redScore = event.score; | |
return; | |
} | |
if (team.equals(LASUtils.BLACK_TEAM)) { | |
blackScore = event.score; | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class PlayerMovement : MonoBehaviour { | |
public float speed; //how fast the player moves | |
public float jumpForce; //how high the player jumps | |
//Private Vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class CameraMovement : MonoBehaviour | |
{ | |
public GameObject player; //Public variable to store a reference to the player game object | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' | |
Shader "Devi/LambertShader" | |
{ | |
Properties | |
{ | |
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0) | |
} | |
SubShader | |
{ |
NewerOlder