Example #1
0
        protected override void Awake()
        {
            base.Awake();
            Instance = this;

            TransitionScene.NewSceneWasLoaded += TransitionScene_NewSceneWasLoaded;
        }
Example #2
0
    private void Awake()
    {
        if (m_inGameCanvas == null)
        {
            m_inGameCanvas = this;
        }
        else if (m_inGameCanvas != this)
        {
            Destroy(gameObject);
        }

        m_fadeImage = transform.Find("Fade_Image").GetComponent <Image>();
    }
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        //DontDestroyOnLoad(gameObject);
    }
Example #4
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();
    }
Example #5
0
    /***************************************************
     *** Setup table and get required objects
     ****************************************************/
    void Start()
    {
        if (cup == null)
        {
            Debug.LogError("Please load a prefab cup into Level Manager");
        }

        if (GameObject.Find("Ball") != null)
        {
            ball         = (Ball)GameObject.Find("Ball").GetComponent(typeof(Ball));
            inGameCanvas = (InGameCanvas)GameObject.Find("Canvas").GetComponent(typeof(InGameCanvas));

            PlaceCups();
            currentGameState = GameState.Ready;

            throwsRemaining = 6;

            throwsRemainingText      = (Text)GameObject.Find("Throw Count").GetComponent <Text>();
            throwsRemainingText.text = "Throws: " + throwsRemaining.ToString();
        }
    }
Example #6
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);
     }
 }