Example #1
0
    void Start()
    {
        SunController = GameObject.Find("Sun")?.GetComponent <SunController>();

        FaceDirect = Vector2.right;
        SetState(eDragonState.Idle);
    }
Example #2
0
    // Start is called before the first frame update
    private void Awake()
    {
        FillGroundTileData();

        gameController  = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        sun             = gameController.sun;
        sun.ReceiveSun += ReceiveSun;
    }
Example #3
0
    /** Only the shooter's instance of the projectile has a collider */
    void OnCollisionEnter(Collision col)
    {
        if (destroyed)
        {
            return;            // Don' process more than one collision... hope this helps...?
        }
        // The first thing a projectile hits should destroy it (unless it's the shooter)
        GameObject obj = col.gameObject;

        // Check if it's a player. If it is, filter out the shooter.
        PlayerMovementController pmc = obj.GetComponent <PlayerMovementController>();
        bool hitPlayer = (pmc != null);

        if (hitPlayer)
        {
            // Is this the shooter?
            if (Tools.NullToEmptyString(obj.GetComponent <PhotonView>().Owner.UserId) == shooterId)
            {
                return;
            }
        }

        // Did we hit a pillar?
        PillarBehaviour pillar    = obj.GetComponent <PillarBehaviour>();
        bool            hitPillar = (pillar != null);

        if (hitPillar)
        {
            // TODO: One day I'll find out why objects are suddenly null...
            if (pillarCtrl == null)
            {
                InitControllers();
            }
            pillarCtrl.BroadcastHitPillar(pillar.id);
        }

        // Is this projectile seeking a targetable player? If so we need to tell him we're not seeking him anymore
        if (lockedOn)
        {
            target.BroadcastBecameUntargeted(shooterId);
        }

        // Did we hit the sun?
        SunController sun = obj.GetComponent <SunController>();

        if (sun != null)
        {
            sun.BroadcastHit(shooterId);
        }

        // In any case, all collisions destroy the projectile
        explosionCtrl.BroadcastExplosion(transform.position, shooterId, false);
        projectileCtrl.BroadcastDestroyProjectile(projectileId);
        destroyed = true;
    }
Example #4
0
    // Start is called before the first frame update
    void Start()
    {
        time = new Timer(LimitMinute, LimitSeconds);
        time.Start();

        sun     = GameObject.Find("Sun");
        sunCtrl = sun.GetComponent <SunController>();

        moon     = GameObject.Find("Moon");
        moonCtrl = moon.GetComponent <MoonController>();
    }
Example #5
0
 private void Awake()
 {
     if (sunControllerInstance != null && sunControllerInstance != this)
     {
         if (gameObject != null)
         {
             Destroy(gameObject);
         }
         return;
     }
     sunControllerInstance = this;
 }
Example #6
0
    // Use this for initialization
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        _ui = FindObjectOfType <UIController>();
        _ui.UpdateLevel(level);
        _ui.UpdateScore(_score);

        _sun = FindObjectOfType <SunController>();

        gladiatorSpawns = gladiatorSpawnsParent.GetComponentsInChildren <Transform>();

        StartCoroutine(BeginTimedReleaseWaves());
    }
Example #7
0
 private void AssignValues(Scene scene, LoadSceneMode mode)
 {
     if (scene.name != "MainMenu" && scene.name != "InitScene")
     {
         clock = FindObjectOfType <ClockendarController>();
         clock.SetDate(date, weekdayIndex, seasonIndex);
         sun = FindObjectOfType <SunController>();
         sun.SetStart(startHour);
         runClock = true;
         clock.UpdateClock(hour, minute);
         sun.UpdateFacing(hour, minute);
         StartCoroutine(RunClock());
     }
 }
Example #8
0
 // Start is called before the first frame update
 void Start()
 {
     if (!(meteorController = GameObject.FindGameObjectWithTag("MeteorController").GetComponent<MeteorController>()))
         meteorController.ControllerStart();
     if (!(hexController = GameObject.FindGameObjectWithTag("HexController").GetComponent<HexController>()))
         hexController.ControllerStart();
     if (!(planetController = GameObject.FindGameObjectWithTag("Planet").GetComponent<PlanetController>()))
         planetController.ControllerStart();
     if (!(cloudController = GameObject.FindGameObjectWithTag("CloudController").GetComponent<CloudController>()))
         cloudController.ControllerStart();
     if (!(hexViewController = GameObject.FindGameObjectWithTag("HexViewController").GetComponent<HexViewController>()))
        hexViewController.ControllerStart();
     if (!(sunController = GameObject.FindGameObjectWithTag("SunController").GetComponent<SunController>()))
         sunController.ControllerStart();
     Debug.Log(sunController.name);
 }
    // Start is called before the first frame update
    void Start()
    {
        // Grab the sun (for the radius)
        sun = GameObject.Find("Sun").GetComponent <SunController>();
        if (sun == null)
        {
            Debug.LogError("Sun not found");
            return;
        }

        // Set random color
        rend = sunMarker.GetComponentInChildren <MeshRenderer>();
        Material mat = new Material(rend.sharedMaterial);

        mat.color           = Random.ColorHSV();
        rend.sharedMaterial = mat;

        // Deactivate renderer by default
        Hide();
    }
Example #10
0
 public void StartGame()
 {
     sunController = Instantiate(Resources.Load <SunController>(SunModule.GameData.SUN_PREFAB_PATH));
     Debug.Log(GameData.LOAD_GAME);
     if (GameData.LOAD_GAME)
     {
         saveData = saveController.GetLastSave();
         CreateBots(true, 1);
         CreateMainPlanet(true);
         CreateBots(true, saveData.Bots.Length - 1);
         CreateGameUI(true);
     }
     else
     {
         CreateBots(false, 1);
         CreateMainPlanet(false);
         CreateBots(false, UnityEngine.Random.Range(GameData.MIN_BOTS, GameData.MAX_BOTS));
         CreateGameUI(false);
     }
     //CreateGameUI();
 }
Example #11
0
    void Awake()
    {
        HitSound = Resources.Load <AudioClip>("lava");
        Earth    = GameObject.FindObjectOfType <EarthController>();
        Sun      = GameObject.FindObjectOfType <SunController>();
        Noise    = MainVirtualCamera.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();

        for (int i = 1; i <= 100; i++)
        {
            var group = new GameObject();
            group.name             = "EnemyGroup" + i;
            group.transform.parent = transform.parent;
            var enemyCount = Random.Range(1, 5);
            for (int j = 0; j < enemyCount; j++)
            {
                var position = (Vector3)Random.insideUnitCircle;
                position.z = 10;
                GameObject enemy = null;
                switch (Random.Range(0, 3))
                {
                case 0:
                    enemy = Enemy1;
                    break;

                case 1:
                    enemy = Enemy2;
                    break;

                case 2:
                    enemy = Enemy3;
                    break;
                }
                Instantiate(enemy, position, Quaternion.identity, group.transform);
            }
        }
    }
Example #12
0
    // Use this for initialization
    void Start()
    {
        colorsOn = false;
        ui       = GameObject.Find("Canvas").GetComponent <CanvasManager> ();
        objects  = GameObject.FindObjectsOfType <OwnableObject> ();
        rm       = GameObject.FindObjectOfType <ResidentManager> ();
        isDay    = true;

        //Sets values to control the sun
        turnTime       = MONTH_LENGTH;
        dayCycleLength = TURNS_UNTIL_NIGHT;
        if (isServer)
        {
            sunController = GameObject.FindObjectOfType <SunController> ();
            sunController.dayRotateSpeed.x   = (-(360 / (turnTime * dayCycleLength))) / 2;
            sunController.nightRotateSpeed.x = (-(360 / (turnTime * dayCycleLength))) / 2;
            players      = GameObject.FindObjectsOfType <Player> ();
            time         = 0;
            monthsPassed = 1;
            foreach (OwnableObject o in objects)
            {
                //Gets rents of all buildings of a type
                if (o is Building)
                {
                    Building building = o.GetComponent <Building> ();
                    if (dictRent.ContainsKey(building.type))
                    {
                        dictRent [building.type] += building.rent;
                    }
                    else
                    {
                        dictRent.Add(building.type, building.rent);
                    }

                    //Gets condition for all buildings of a type
                    if (dictCondition.ContainsKey(building.type))
                    {
                        dictCondition [building.type] += building.condition;
                    }
                    else
                    {
                        dictCondition.Add(building.type, building.condition);
                    }

                    //Gets safety for all buildings of a type
                    if (dictSafety.ContainsKey(building.type))
                    {
                        dictSafety [building.type] += building.safety;
                    }
                    else
                    {
                        dictSafety.Add(building.type, building.safety);
                    }

                    //Gets a dictionary of number of buildings of each type
                    if (dictNumberOfType.ContainsKey(building.type))
                    {
                        dictNumberOfType [building.type] += 1;
                    }
                    else
                    {
                        dictNumberOfType.Add(building.type, 1);
                    }
                }
            }
        }
    }
Example #13
0
 private void Start()
 {
     leaveController = GameObject.FindWithTag("Player").GetComponent <HigerDimensionController>();
     sunController   = GameObject.FindWithTag("Player").GetComponent <SunController>();
     moonController  = GameObject.FindWithTag("Player").GetComponent <MoonController>();
 }
Example #14
0
    // Start is called before the first frame update
    void Start()
    {
        var obj = GameObject.Find("Sun");

        sunCtrl = obj.GetComponent <SunController>();
    }