Ejemplo n.º 1
0
        private void StartAnimation(TurbineState state)
        {
            IsInfoShown = false;
            TurbineAnimationType animationType;

            switch (state)
            {
            case TurbineState.Default:
            {
                animationType = TurbineAnimationType.None;
                break;
            }

            case TurbineState.Cut:
            {
                animationType = TurbineAnimationType.Cutoff;
                break;
            }

            case TurbineState.Exploded:
            {
                animationType = TurbineAnimationType.Move;
                break;
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, null);
            }
            SceneControllerTurbine.Instance.StartAnimations(animationType);
        }
Ejemplo n.º 2
0
    public static bool Initialize()
    {
        string JSONAggregate = Resources.Load <TextAsset>("States").text;

        string[] objects = JSONAggregate.Split('#');

        lowFireState         = JsonUtility.FromJson <TurbineState>(objects[0]);
        highFireState        = JsonUtility.FromJson <TurbineState>(objects[1]);
        saboteurState        = JsonUtility.FromJson <TurbineState>(objects[2]);
        brokenState          = JsonUtility.FromJson <TurbineState>(objects[3]);
        dirtyState           = JsonUtility.FromJson <TurbineState>(objects[4]);
        occupiedState        = JsonUtility.FromJson <TurbineState>(objects[5]);
        tutorialLowFireState = JsonUtility.FromJson <TurbineState>(objects[6]);
        turbineCooldownState = JsonUtility.FromJson <TurbineState>(objects[7]);

        Debug.Log(lowFireState.name);
        Debug.Log(highFireState.name);
        Debug.Log(saboteurState.name);
        Debug.Log(brokenState.name);
        Debug.Log(dirtyState.name);
        Debug.Log(occupiedState.name);
        Debug.Log(tutorialLowFireState.name);
        Debug.Log(turbineCooldownState.name);

        return(true);
    }
Ejemplo n.º 3
0
 public void OnStateChange(TurbineState oldState, TurbineState newState)
 {
     Clear();
     if (newState == null)
     {
         calledHelp = false;
     }
     else if (newState != null && !calledHelp)
     {
         if (newState.name == TurbineStateManager.saboteurState.name)
         {
             OnPolice();
         }
         else if (newState.name == TurbineStateManager.occupiedState.name)
         {
             OnPolice();
         }
         else if (newState.name == TurbineStateManager.brokenState.name)
         {
             OnRepair();
         }
         else if (newState.name == TurbineStateManager.lowFireState.name)
         {
             OnFiremen();
         }
         else if (newState.name == TurbineStateManager.highFireState.name)
         {
             OnFiremen();
         }
         else if (newState.name == TurbineStateManager.dirtyState.name)
         {
             OnCleanup();
         }
     }
 }
    public void OnStateChange(TurbineState oldState, TurbineState newState)
    {
        if (oldState != null && oldState.name != TurbineStateManager.turbineCooldownState.name)
        {
            if (oldState.name == TurbineStateManager.brokenState.name)
            {
                Break(false);
            }
            else if (oldState.name == TurbineStateManager.lowFireState.name)
            {
                LowFire(false);
            }
            else if (oldState.name == TurbineStateManager.highFireState.name)
            {
                HighFire(false);
            }
            else if (oldState.name == TurbineStateManager.dirtyState.name)
            {
                Dirty(false);
            }
            else if (oldState.name == TurbineStateManager.occupiedState.name)
            {
                GetComponentInChildren <Saboteur>().EndAnimation();
            }
        }

        if (newState != null && newState.name != TurbineStateManager.turbineCooldownState.name)
        {
            if (newState.name == TurbineStateManager.saboteurState.name)
            {
                GetComponentInChildren <Saboteur> ().StartAnimation();
            }
            else if (newState.name == TurbineStateManager.brokenState.name)
            {
                Break(true);
            }
            else if (newState.name == TurbineStateManager.lowFireState.name)
            {
                LowFire(true);
            }
            else if (newState.name == TurbineStateManager.highFireState.name)
            {
                HighFire(true);
            }
            else if (newState.name == TurbineStateManager.dirtyState.name)
            {
                Dirty(true);
            }
        }
        if (newState != null && newState.name == TurbineStateManager.turbineCooldownState.name && oldState.name != TurbineStateManager.turbineCooldownState.name)
        {
            Sparkles(true);
            if (oldState.name == TurbineStateManager.saboteurState.name)
            {
                GetComponentInChildren <Saboteur>().EndAnimation();
            }
        }
    }
Ejemplo n.º 5
0
    public static void CreateTemplate()
    {
        lowFireState = new TurbineState();

        string str = JsonUtility.ToJson(lowFireState, true) + "\n#\n" +
                     JsonUtility.ToJson(lowFireState, true) + "\n#\n" +
                     JsonUtility.ToJson(lowFireState, true) + "\n#\n" +
                     JsonUtility.ToJson(lowFireState, true) + "\n#\n" +
                     JsonUtility.ToJson(lowFireState, true);

        System.IO.File.WriteAllText(@"C:\Users\Giulio Robecchi\Desktop\States.txt", str);
    }
Ejemplo n.º 6
0
	public void ActivateAltarEvent( object sender ){
		GameObject currentTurbineSwitch = ( GameObject )sender;
		if( currentTurbineSwitch.name == "_firstPillar" ) {
			currentTurbineState = TurbineState.firstTurbineActive;
		}
		else if( currentTurbineSwitch.name == "_secondPillar" ){
			currentTurbineState = TurbineState.secondTurbineActive;
		} else {
			currentTurbineState = TurbineState.bothTurbinesActive;
		}
		if( turbineSwitchFirstInteraction ) {
			turbineSwitchFirstInteraction = false;
			AddTextToPlayersDialogue( "It appears to be some sort of release switch." );
		} else {
			ToggleTurbineSwitch( currentTurbineSwitch );
		}
	}
Ejemplo n.º 7
0
    /// <summary>
    /// Returns a copy of this instance, with the specificed owner.
    /// forceThrough forces state, ignoring pause and other states.
    /// </summary>
    /// <param name="pOwner">The owner of the new instance.</param>
    public TurbineState Copy(TurbineObject pOwner, bool forceThrough = false)
    {
        if (!forceThrough && TutorialProgression.Instance.ProgressPause)
        {
            Debug.Log("no forced through, blocked by pause.");
            return(null);
        }
        else if (!forceThrough && pOwner.state.value != null)
        {
            Debug.Log("no forced through, blocked by null.");
            return(null);
        }
        else
        {
            Debug.Log("not blocked");
            TurbineState ts = new TurbineState();

            ts.name = this.name;

            ts.timer = this.timer;
            ts._efficiencyMultiplyer = this._efficiencyMultiplyer;

            ts.negativeEffect   = this.negativeEffect;
            ts.timed            = this.timed;
            ts.endOnTap         = this.endOnTap;
            ts.endOnWind        = this.endOnWind;
            ts.winzoneDependent = this.winzoneDependent;
            ts.setsOnHighFire   = this.setsOnHighFire;
            ts.breaksTurbine    = this.breaksTurbine;
            ts.dirtiesTurbine   = this.dirtiesTurbine;
            ts.setsOccupied     = this.setsOccupied;

            ts.endOnCleanup = this.endOnCleanup;
            ts.endOnFiremen = this.endOnFiremen;
            ts.endOnPolice  = this.endOnPolice;
            ts.endOnRepair  = this.endOnRepair;
            ts.isCooldown   = this.isCooldown;

            ts.SetOwner(pOwner);

            Debug.Log("[State] State " + name + " started at " + Time.time);
            return(ts);
        }
    }
 public void OnDirtEnd(TurbineState oldState, TurbineState newState)
 {
     dirtyWasfought = (newState == null || newState.name == TurbineStateManager.turbineCooldownState.name);
 }
 public void OnBrokenEnd(TurbineState oldState, TurbineState newState)
 {
     brokenWasFixed = (newState == null || newState.name == TurbineStateManager.turbineCooldownState.name);
 }
 public void OnFireEnd(TurbineState oldState, TurbineState newState)
 {
     fireWasFought = (newState == null || newState.name == TurbineStateManager.turbineCooldownState.name);
     Debug.Log(fireWasFought);
 }
 // Called by statechanges. Change Bools of cleared goals
 public void OnSaboteurEnd(TurbineState oldState, TurbineState newState)
 {
     saboteurWasFought = (newState == null || newState.name == TurbineStateManager.turbineCooldownState.name);
 }