public Ground GetGroundPrefab(GroundTypes groundType)
    {
        foreach (var item in prefabList.grounds)
        {
            if (item.groundType == groundType)
            {
                return(item);
            }
        }

        Debug.LogWarning("No Ground Prefab find for " + groundType);

        return(null);
    }
Example #2
0
    private void OnDrawGizmos()
    {
        if (Application.isPlaying)
        {
            return;
        }

        if (pieceType != _pieceType)
        {
            CreatePiece(pieceType);
            _pieceType = pieceType;
        }

        if (groundType != _groundType)
        {
            CreateGround(groundType);
            _groundType = groundType;
        }
    }
Example #3
0
    public void CreateGround(GroundTypes newGroundType)
    {
        bool hay = false;

        if (gameObject.name.EndsWith("_b"))
        {
            hay = true;
        }

        groundType = newGroundType;

        if (ground != null)
        {
            DestroyImmediate(ground.gameObject);
        }

        if (groundType != GroundTypes.Void)
        {
            Ground prefab = GridManager.Instance.GetGroundPrefab(groundType);

            if (prefab != null)
            {
                // prefab.transform.GetChild(0).GetComponent<Renderer>().material = alternative_tile_material;

                ground = Instantiate(prefab, transform.position, prefab.transform.rotation, transform);
                // ground.transform.GetChild(0).GetComponent<Renderer>().material = alternative_tile_material;

                if (hay)
                {
                    ground.GetComponent <Renderer>().material = alternative_tile_material;
                }

                canPlantOnIt = prefab.canPlantOnIt;
            }
        }
    }
Example #4
0
 public TransportRequest(Human sensder, GroundTypes ground)
 {
     Sender = sender;
     Ground = ground;
 }
Example #5
0
 public void Travel(GroundTypes type)
 {
     _events.Publish(new TransportRequest(this, type));
     //see Handle implementation for details
     //if (Transport != null) Transport.Travel();
 }