Beispiel #1
0
 private void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
     }
 }
Beispiel #2
0
    void Start()
    {
        wsc           = GameObject.Find("WorldScene").GetComponent <WorldSceneController>();
        wcc           = GameObject.Find("WorldControllerCanvas").GetComponent <WorldCanvasController>();
        wsc.allowMove = true;
        GameController gc = GameObject.Find("GameController").GetComponent <GameController>();

        latestLevel = gc.PlayerLastLevel;
        if ((latestLevel + 1) < level)
        {
            status = _status.off;
        }
        if (latestLevel > level)
        {
            status = _status.on;
        }
        if ((latestLevel + 1) == level)
        {
            status = _status.bouncing;
        }
        if (latestLevel == level)
        {
            GameObject boat = GameObject.Find("boat");
            boat.transform.position = transform.position;
        }
        switch (status)
        {
        case _status.bouncing: GameObject.Instantiate(LatestLevel, transform); break;

        case _status.on: GameObject.Instantiate(FinishedLevel, transform); break;

        default: GameObject.Instantiate(UnreachedLevel, transform); break;
        }
    }
    public ControllersProvider(
        SceneController sceneController,
        UIController uiController,
        UnityEventsBridge unityEventsBridge,
        WorldCanvasController worldCanvasController)
    {
        controllers = new Dictionary <Type, IController>
        {
            { typeof(SceneController), sceneController },
            { typeof(UIController), uiController },
            { typeof(WorldCanvasController), worldCanvasController },

            { typeof(SceneSizeController), new SceneSizeController(sceneController) },
            { typeof(UnityEventsController), new UnityEventsController(unityEventsBridge) },

            { typeof(TriggerController), new TriggerController() },
            { typeof(MatchContoller), new MatchContoller() },
            { typeof(ScoreController), new ScoreController() },
            { typeof(BallMovementController), new BallMovementController() },
            { typeof(InputSystem), new InputSystem() },
            { typeof(GameModeController), new GameModeController() },
            { typeof(SaveController), new SaveController() },
            { typeof(BallCustomizeController), new BallCustomizeController() },
        };
    }
    /// <summary>
    /// When champion created Champion and teamID passed
    /// </summary>
    /// <param name="_champion"></param>
    /// <param name="_teamID"></param>
    public void Init(Champion _champion, int _teamID)
    {
        champion = _champion;
        teamID   = _teamID;

        //store scripts
        map                   = GameObject.Find("Scripts").GetComponent <Map>();
        aIopponent            = GameObject.Find("Scripts").GetComponent <AIopponent>();
        gamePlayController    = GameObject.Find("Scripts").GetComponent <GamePlayController>();
        worldCanvasController = GameObject.Find("Scripts").GetComponent <WorldCanvasController>();
        navMeshAgent          = this.GetComponent <NavMeshAgent>();
        championAnimation     = this.GetComponent <ChampionAnimation>();

        //disable agent
        navMeshAgent.enabled = false;

        //set stats
        maxHealth     = champion.health;
        currentHealth = champion.health;
        currentDamage = champion.damage;

        worldCanvasController.AddHealthBar(this.gameObject);

        effects = new List <Effect>();
    }
Beispiel #5
0
 void Start()
 {
     gc  = GameObject.Find("GameController").GetComponent <GameController>();
     wcc = GameObject.Find("WorldControllerCanvas").GetComponent <WorldCanvasController>();
     cancelButton.onClick.AddListener(DoCancel);
     startLevelButton.onClick.AddListener(DoStart);
 }
Beispiel #6
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        else
        {
            Destroy(gameObject);
            return;
        }

        if (config == null)
        {
            Debug.LogWarning("Config was not assigned for world canvas. Assigning default config.");
            config = ScriptableObject.CreateInstance <WorldCanvasConfig>();
        }

        transform = GetComponent <Transform>();
    }