Beispiel #1
0
    // Has received motivation. A likely source is from on of the Captain's morale inducements.
    public void Motivate()
    {
        var randWorkRate = Random.Range(0, 3);

        switch (randWorkRate)
        {
        case 0:
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <SlowWorkerPirateCommand>());
            Debug.Log(String.Format("Slow work assigned.\n"));
            break;

        case 1:
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <NormalWorkerPirateCommand>());
            Debug.Log(String.Format("Normal work assigned.\n"));
            break;

        case 2:
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <FastWorkerPirateCommand>());
            Debug.Log(String.Format("Fast work assigned.\n"));
            break;

        default:      // should not be able to reach this case
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <NoWorkPirateCommand>());
            break;
        }

        this.gameObject.GetComponent <Animator>().SetBool("Exhausted", false);
        this.Active = true;
    }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        this.ActiveCommand = ScriptableObject.CreateInstance <NoWorkPirateCommand>();
        this.Active        = false;

        // Hackneyed way to get Pirate animation to run Idle at start
        this.gameObject.GetComponent <Animator>().SetBool("Exhausted", true);
    }
Beispiel #3
0
 // Update is called once per frame
 void Update()
 {
     if (this.Active)
     {
         var working = this.ActiveCommand.Execute(this.gameObject, this.ProductPrefab);
         if (working)
         {
             this.gameObject.GetComponent <Animator>().SetBool("Exhausted", working);
             this.ActiveCommand = ScriptableObject.CreateInstance <NoWorkPirateCommand>();
         }
     }
 }
    //Has received motivation. A likely source is from on of the Captain's morale inducements.
    public void Motivate()
    {
        int actionNumber = Random.Range(1, 4);

        if (actionNumber == 1)
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <FastWorkPirateCommand>());
        }
        else if (actionNumber == 2)
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <NormalWorkPirateCommand>());
        }
        else if (actionNumber == 3)
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <FastWorkPirateCommand>());
        }
    }
Beispiel #5
0
    //Has received motivation. A likely source is from on of the Captain's morale inducements.
    public void Motivate()
    {
        //Generate a random value between 0 and 3
        float randWorkCoeff = Random.Range(0, 3);

        //assign a command according to the random value
        if (randWorkCoeff <= SLOW_WORK_COEFF)
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <SlowWorkerPirateCommand>());
        }
        else if (randWorkCoeff <= NORMAL_WORK_COEFF)
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <NormalWorkerPirateCommand>());
        }
        else
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <FastWorkerPirateCommand>());
        }
    }
Beispiel #6
0
    //Has received motivation. A likely source is from on of the Captain's morale inducements.
    public void Motivate()
    {
        float choice = (Random.value) * 100;

        if (choice <= 33.0)
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <FastWorkerPirateCommand>());
        }
        else if (choice > 33.0 && choice <= 66.0)
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <SlowWorkerPirateCommand>());
        }
        else
        {
            this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <NormalWorkerPirateCommand>());
        }
        // The function will generate a randum number called "choice" in range 1-100. Then, base on this
        // number, the pirates will randumly get in to one of three working status.
    }
Beispiel #7
0
 // Start is called before the first frame update
 void Start()
 {
     this.ActiveCommand = ScriptableObject.CreateInstance <NoWorkPirateCommand>();
 }
Beispiel #8
0
 //Has received motivation. A likely source is from on of the Captain's morale inducements.
 public void Motivate()
 {
     this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <NoWorkPirateCommand>());
 }
Beispiel #9
0
    //Has received motivation. A likely source is from on of the Captain's morale inducements.
    public void Motivate()
    {
        var rnd = Random.Range(1, 4);

        this.ActiveCommand = Object.Instantiate(ScriptableObject.CreateInstance <FastWorkerPirateCommand>());
    }