コード例 #1
0
 /// <summary>
 /// Called to give a PlayerBackNotification all important variables
 /// </summary>
 /// <param name="notificationText">The text that is displayed on the notification</param>
 /// <param name="floatUpSpawner">Reference to the FloatUpSpawner</param>
 /// <param name="type">The type of resource that the player gets</param>
 /// <param name="secondsSincePause">The seconds the player paused the game</param>
 /// <param name="additionalMoney">The money the player gets additional to the secondsSincePause</param>
 /// <param name="soundController">The sound controller to play the sound</param>
 /// <param name="harvesters">List of all harvesters</param>
 public void Initialize(string notificationText, FloatUpSpawner floatUpSpawner, FloatUp.ResourceType type, long secondsSincePause, long additionalMoney, SoundController soundController, ref List <Harvester> harvesters)
 {
     this.NotificationText.text = notificationText;
     this.floatUpSpawner        = floatUpSpawner;
     this.type = type;
     this.secondsSincePause = secondsSincePause;
     this.additionalMoney   = additionalMoney;
     this.harvesters        = harvesters;
     this.soundController   = soundController;
 }
コード例 #2
0
    /// <summary>Method creates a new FloatUp element of the given parameters</summary>
    /// <param name="value">The value to display in the generated FloatUp element</param>
    /// <param name="type">The type of the generated FloatUp element. For example this could decide between Powerlevel and Dollar.</param>
    /// <param name="pos">The position at which the FloatUp will spawn and begin traveling</param>
    public void GenerateFloatUp(long value, FloatUp.ResourceType type, Vector2 pos)
    {
        var go = Instantiate(this.FloatUpPrefab, transform);

        if (value > 0)
        {
            pos += new Vector2(0, 25);
        }
        else
        {
            pos += new Vector2(0, -25);
        }

        go.transform.position = pos;
        go.GetComponent <FloatUp>().Initialize(type, value, this.FadeTime, this.TravelDistance);
        this.soundController.StartSound(SoundController.Sounds.FLOATUP);
    }