Beispiel #1
0
    // Use this for initialization
    protected override void Start()
    {
        animator = GetComponent <Animator>();
        food     = GameManager.instance.playerFoodPoints;

        foodText.text = "Food:" + food;
        //initialiseFreeMove to true
        freeMove = true;

        base.Start();
        //TODO some kind of statistics loading/factory
        statistics = GetComponent <StatisticsData>();
        //init speedometer
        speedometer.Add(statistics.GetSpeed());
        //init actionometer
        actionometer = GetComponent <Actionometer>();
        actionometer.init();

        gameEvents = GameEvents.instance;
        //TODO we should place the player, who is currentSelectedPlayer
        //TODO this part must not be done if we are not a player
        GameManager.instance.setSelectedCreature(this);
        //we must also place him into spawn location
        Vector3 spawnPosition = GameManager.instance.playerSpawnPoint.GetLocation();

        if (spawnPosition != null)
        {
            this.transform.position = spawnPosition;
        }
    }
Beispiel #2
0
 public void Init(ActionOption actionOption, Actionometer actionometer)
 {
     this.actionometer = actionometer;
     this.actionOption = actionOption;
     actionButton.SetActive(actionOption.isAction);
     bonusActionButton.SetActive(actionOption.isBonusAction);
     this.text.text = actionOption.action.GetName();
 }
Beispiel #3
0
    private void UpdateActionDisplay()
    {
        Creature selectedCreature = GameManager.instance.getSelectedCreature();

        if (selectedCreature == null)
        {
            return;
        }
        Actionometer actionometer = selectedCreature.GetActionometer();

        updateActionHolder(actionometer.usedAction.data, actionHolder);
        updateActionHolder(actionometer.usedBonusAction.data, bonusActionHolder);

        UpdateComponentPositioning();
    }
Beispiel #4
0
    private void InitActionIconsWithOptions()
    {
        //TODO when player changes, init ActionIcons with players actionometer

        List <ActionOption> options = creature.GetStatistics().actionOptions;

        Debug.Log("InitActionIconsWithOptions options.Count=" + options.Count);
        Actionometer actionometer = creature.GetActionometer();

        for (int i = 0; i < options.Count; i++)
        {
            ActionOption option = options [i];
            if (i >= actionIcons.Count)
            {
                Debug.LogError("Creature has too many options, you have not implemented paging for actionIcons. actionIcons.Count=" + actionIcons.Count + " i=" + i);
            }
            else
            {
                actionIcons [i].Init(option, actionometer);
            }
        }
    }