예제 #1
0
    IEnumerator CallCountDown(SquareCell caller)
    {
        //Debug.Log("callCountDown Called");
        yield return(new WaitForSeconds(lifetime));

        SetToPrevious(caller);
        caller.Refresh();
        //Debug.Log("mud revereted to previous");
    }
예제 #2
0
 public void LookToSeeIfNeedRefresh(object sender, object info)
 {
     if (sender == block)
     {
         Refresh();
         for (int i = 0; i < neighbors.Length; i++)
         {
             SquareCell neighbor = neighbors[i];
             if (neighbor != null && neighbor.chunk != chunk)
             {
                 neighbor.Refresh();
             }
         }
     }
 }
예제 #3
0
    public static void SetToMud(SquareCell caller, ref GroundMaterial material) //temporary mud for construction/destruction
    {
        GroundMaterial newMaterial = Instantiate(material);

        newMaterial.tileTypeName = "Mud";
        newMaterial.color        = new Color32(0x44, 0x20, 0x0A, 0xFF);
        newMaterial.blendEdge    = true;
        newMaterial.decays       = true;
        newMaterial.lifetime     = 5f + Random.Range(1f, 1f);
        if (material.previousMaterial == null) // stops building long chains of mud decaying to mud
        {
            newMaterial.previousMaterial = material;
        }
        material    = newMaterial;
        caller.Tile = material;
        caller.Refresh();
        caller.StartCoroutine(material.CallCountDown(caller));
    }