コード例 #1
0
ファイル: ResourceSource.cs プロジェクト: Ellpeck/Colony
 public Data(ResourceSource source)
 {
     this.prefabName = source.savedPrefabName;
     this.position   = source.transform.position;
     this.type       = (int)source.type;
     this.amount     = source.amount;
 }
コード例 #2
0
 private Data(Building building)
 {
     this.prefabName        = building.savedPrefabName;
     this.position          = building.transform.position;
     this.isFinished        = building.IsFinished;
     this.requiredResources = building.requiredResources;
 }
コード例 #3
0
 public NavigationMapInfo(Vector3 mapSize, Vector3 tileSize)
 {
     this.mapSize  = mapSize;
     this.tileSize = tileSize;
     _tileCountX   = Mathf.CeilToInt(mapSize.x / tileSize.x);
     _tileCountZ   = Mathf.CeilToInt(mapSize.z / tileSize.z);
 }
コード例 #4
0
ファイル: VoxelBuffer.cs プロジェクト: skmang/UnityPlayground
 public Box3i(Vector3 min, Vector3 max)
 {
     minP   = min;
     maxP   = max;
     xRange = (float)max.x - min.x;
     yRange = (float)max.y - min.y;
     zRange = (float)max.z - min.z;
 }
コード例 #5
0
ファイル: Person.cs プロジェクト: Ellpeck/Colony
 public Data(Person person)
 {
     this.prefabName              = person.savedPrefabName;
     this.displayName             = person.GetComponent <Selectable>().menuName;
     this.position                = person.transform.position;
     this.carryingResource        = person.CarryingResource;
     this.resourceToBeGathered    = person.resourceToBeGathered;
     this.shouldConstructBuilding = person.shouldContructBuilding;
 }
コード例 #6
0
ファイル: RotateCam.cs プロジェクト: skmang/UnityPlayground
    void Update()
    {
        SerializableVec3 pos = follow.position + offset;

        transform.position = pos;
        return;

        rotationX += Input.GetAxis("Mouse X") * cameraSensitivity * Time.deltaTime;
        rotationY += Input.GetAxis("Mouse Y") * cameraSensitivity * Time.deltaTime;
        rotationY  = Mathf.Clamp(rotationY, -90, 90);

        transform.localRotation  = Quaternion.AngleAxis(rotationX, Vector3.up);
        transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left);

        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            transform.position += transform.forward * (normalMoveSpeed * fastMoveFactor) * Input.GetAxis("Vertical") * Time.deltaTime;
            transform.position += transform.right * (normalMoveSpeed * fastMoveFactor) * Input.GetAxis("Horizontal") * Time.deltaTime;
        }
        else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
        {
            transform.position += transform.forward * (normalMoveSpeed * slowMoveFactor) * Input.GetAxis("Vertical") * Time.deltaTime;
            transform.position += transform.right * (normalMoveSpeed * slowMoveFactor) * Input.GetAxis("Horizontal") * Time.deltaTime;
        }
        else
        {
            transform.position += transform.forward * normalMoveSpeed * Input.GetAxis("Vertical") * Time.deltaTime;
            transform.position += transform.right * normalMoveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime;
        }


        if (Input.GetKey(KeyCode.Q))
        {
            transform.position += transform.up * climbSpeed * Time.deltaTime;
        }
        if (Input.GetKey(KeyCode.E))
        {
            transform.position -= transform.up * climbSpeed * Time.deltaTime;
        }

        if (Input.GetKeyDown(KeyCode.End))
        {
            Screen.lockCursor = (Screen.lockCursor == false) ? true : false;
        }
    }