Ejemplo n.º 1
0
    private void ResetBuildAndStartScene(SceneActor[] predefinedSceneActors)
    {
        // Reset the scene to blank
        ResetBoard();   // put the squares back in their reset position
        ReleaseBoard(); // Drop the squares
        actors           = new List <Actor>();
        playerCount      = 0;
        monsterCount     = 0;
        currentActorTurn = -1; // -1 so turns actually start a 0

        // Build scene objects from predefined
        foreach (SceneActor actorData in predefinedSceneActors)
        {
            // Create GameObject and place it in the correct square
            GameObject newGameObject;
            if (actorData.IsPlayer)
            {
                newGameObject = (GameObject)Instantiate(instance.PlayerPrefabList[actorData.PrefabIndex]);
                playerCount++;
            }
            else
            {
                newGameObject = (GameObject)Instantiate(instance.MonsterPrefabsList[actorData.PrefabIndex]);
                monsterCount++;
            }
            Space   spaceToPlace = spaces[actorData.x, actorData.z];
            Vector3 squareBasis  = spaceToPlace.gameSpace.transform.position;
            newGameObject.transform.position = new Vector3(squareBasis.x, DropFromHeight + 1, squareBasis.z);

            TokenStats stats    = newGameObject.GetComponent <TokenStats>();
            Actor      newActor = new Actor(newGameObject, actorData.x, actorData.z, actorData.ActorColor, actorData.IsPlayer, stats.characterName, stats.HP, stats.AC,
                                            stats.InitativeMod, stats.Speed, stats.AttackName, stats.AttackRange, stats.AttackMod, stats.DamageDiceNum,
                                            stats.DamageDiceMagnitude, stats.DamageMod);
            spaces[actorData.x, actorData.z].isBlocked = true;

            actors.Add(newActor);
        }

        // Show UI
        InGameCanvas.SetActive(true);

        // Roll init and sort
        RollInit();

        // Start the action!
        NextTurn();
    }
Ejemplo n.º 2
0
 public void SetState(STATES newSate)
 {
     state = newSate;
     if (newSate == STATES.AWAITING_INPUT)
     {
         MouseHoverHighlight.isEffectActive = true;
         ((Behaviour)actors[currentActorTurn].tokenRef.GetComponent("Halo")).enabled = true;
     }
     else if (newSate == STATES.ANIMATING_ACTION)
     {
         MouseHoverHighlight.isEffectActive = false;
         ((Behaviour)actors[currentActorTurn].tokenRef.GetComponent("Halo")).enabled = false;
     }
     else if (newSate == STATES.MENU)
     {
         MouseHoverHighlight.isEffectActive = false;
         ((Behaviour)actors[currentActorTurn].tokenRef.GetComponent("Halo")).enabled = false;
         InGameCanvas.SetActive(false);
         MenuCanvas.SetActive(true);
     }
 }