Наследование: MonoBehaviour
Пример #1
0
    void OnGUI()
    {
        GUI.DrawTexture(new Rect(Event.current.mousePosition.x - cursorSizeX / 2, Event.current.mousePosition.y - cursorSizeY / 2, cursorSizeX, cursorSizeY), myCursor);
        timeAffiche.GetComponent <TextMesh>().text    = "" + (int)TurtleTimer.timer;
        garbageAffiche.GetComponent <TextMesh>().text = ClickGarbage.maxGarbage.ToString();

        if (TurtleCollision.turtleFed == 5)
        {
            timeMesh.GetComponent <TextMesh>().text    = "" + (int)TurtleTimer.timer;
            garbageMesh.GetComponent <TextMesh>().text = ClickGarbage.maxGarbage.ToString();
            stars[0].SetActive(true);
            if (ClickGarbage.maxGarbage > 10)
            {
                stars[1].SetActive(true);
            }
            if (ClickGarbage.maxGarbage > 20)
            {
                stars[2].SetActive(true);
            }

            winLayer.SetActive(true);
            s1         = gameManager.GetComponent <SpawnSystem>();
            s1.enabled = false;
        }
    }
Пример #2
0
        // StateMachine.IState Implementation
        public void FixedTick()
        {
            var activeUnicorns = SpawnSystem.GetActiveUnicorns();

            if (activeUnicorns.Count == 0)
            {
                return;
            }

            int   closestIndex      = -1;
            float closestDistanceSq = float.PositiveInfinity;

            for (int i = 0; i < activeUnicorns.Count; i++)
            {
                var transform = activeUnicorns[i].transform;
                if (behaviour.transform == transform)
                {
                    break;
                }
                var vecToUnicorn = transform.position - behaviour.transform.localPosition;
                var distSq       = Vector3.Dot(vecToUnicorn, vecToUnicorn);
                if (distSq < closestDistanceSq)
                {
                    closestIndex      = i;
                    closestDistanceSq = distSq;
                }
            }

            if (closestIndex != -1)
            {
                behaviour.guardTarget = activeUnicorns[closestIndex].transform;
            }
        }
 void Enqueue()
 {
     SpawnSystem.Enqueue(new Spawn()
                         .WithPrefab(currentPrefab)
                         .WithComponentList(
                             new NavAgent
     {
         JumpDegrees      = 45,
         JumpGravity      = 200,
         TranslationSpeed = 20,
         TypeID           = NavUtil.GetAgentType(NavConstants.HUMANOID),
         Offset           = new float3(0, 1, 0)
     },
                             new Parent {
     },
                             new LocalToParent {
     },
                             new LocalToWorld
     {
         Value = float4x4.TRS(
             new float3(0, 1, 0),
             quaternion.identity,
             1
             )
     },
                             new NavNeedsSurface {
     }
                             ),
                         enqueueCount
                         );
 }
Пример #4
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            numSpace++;
            time = 0;
        }

        if (Input.GetKeyDown(KeyCode.K))
        {
            numK++;
        }

        if (numK > 10)
        {
            int colorID = Random.Range(0, flowerColors.Length - 1);
            SpawnSystem.SpawnFlower(flower, flowerColors[colorID], spawnPoints, gameObject.transform);
            numK = 0;
        }

        if (time > 1)
        {
            for (int i = 0; i < numSpace; i++)
            {
                SpawnSystem.SpawnFlower(flower, flowerColors[0], spawnPoints, gameObject.transform);
            }

            time     = 0;
            numSpace = 0;
        }

        time += Time.deltaTime;
    }
Пример #5
0
        void Start()
        {
            var prefabEntity = entityManager.CreateEntityQuery(typeof(DinosaurPrefab)).GetSingleton <DinosaurPrefab>().Value;

            SpawnSystem.Enqueue(new Spawn()
                                .WithPrefab(prefabEntity)
                                .WithComponentList(
                                    new NavAgent
            {
                JumpDegrees          = 45,
                JumpGravity          = 100,
                JumpSpeedMultiplierX = 2,
                JumpSpeedMultiplierY = 4,
                TranslationSpeed     = 40,
                TypeID = NavUtil.GetAgentType(NavConstants.HUMANOID),
                Offset = new float3(0, 1, 0)
            },
                                    new Parent {
            },
                                    new LocalToParent {
            },
                                    new LocalToWorld
            {
                Value = float4x4.TRS(
                    new float3(0, 1, 0),
                    quaternion.identity,
                    1
                    )
            },
                                    new NavNeedsSurface {
            }
                                    )
                                );
        }
Пример #6
0
    public void ResolveNodeReferences()
    {
        if (NodeReferencesResolved)
        {
            return;
        }

        world       = GetNode <Node>("World");
        HUD         = GetNode <MicrobeHUD>("MicrobeHUD");
        tutorialGUI = GetNode <MicrobeTutorialGUI>("TutorialGUI");
        rootOfDynamicallySpawned = GetNode <Node>("World/DynamicallySpawned");
        Camera       = world.GetNode <MicrobeCamera>("PrimaryCamera");
        Clouds       = world.GetNode <CompoundCloudSystem>("CompoundClouds");
        worldLight   = world.GetNode <DirectionalLight>("WorldLight");
        guidanceLine = GetNode <GuidanceLine>(GuidanceLinePath);
        pauseMenu    = GetNode <PauseMenu>(PauseMenuPath);

        // These need to be created here as well for child property save load to work
        TimedLifeSystem = new TimedLifeSystem(rootOfDynamicallySpawned);
        ProcessSystem   = new ProcessSystem(rootOfDynamicallySpawned);
        microbeAISystem = new MicrobeAISystem(rootOfDynamicallySpawned);
        FluidSystem     = new FluidSystem(rootOfDynamicallySpawned);
        spawner         = new SpawnSystem(rootOfDynamicallySpawned);

        NodeReferencesResolved = true;
    }
Пример #7
0
        void Start()
        {
            var prefabEntity = entityManager.CreateEntityQuery(typeof(PersonPrefab)).GetSingleton <PersonPrefab>().Value;

            SpawnSystem.Enqueue(new Spawn()
                                .WithPrefab(prefabEntity)
                                .WithComponentList(
                                    new Translation
            {
                Value = new float3(0, 1, 0)
            }
                                    )
                                );

            SpawnSystem.Enqueue(new Spawn()
                                .WithPrefab(prefabEntity)
                                .WithComponentList(
                                    new Translation
            {
                Value = new float3(5, 1, 0)
            }
                                    )
                                );

            SpawnSystem.Enqueue(new Spawn()
                                .WithPrefab(prefabEntity)
                                .WithComponentList(
                                    new Translation
            {
                Value = new float3(-5, 1, 0)
            }
                                    )
                                );
        }
Пример #8
0
        void Start()
        {
            var prefabEntity = entityManager.CreateEntityQuery(typeof(NavAgentPrefab)).GetSingleton <NavAgentPrefab>().Value;

            SpawnSystem.Enqueue(new Spawn()
                                .WithPrefab(prefabEntity)
                                .WithComponentList(
                                    new NavAgent
            {
                JumpDegrees          = 45,
                JumpGravity          = 100,
                JumpSpeedMultiplierX = 1.5f,
                JumpSpeedMultiplierY = 2,
                TranslationSpeed     = 20,
                TypeID = NavUtil.GetAgentType(NavConstants.HUMANOID),
                Offset = new float3(0, 1, 0)
            },
                                    new NavNeedsSurface {
            },
                                    new Parent {
            },
                                    new LocalToParent {
            },
                                    new Translation
            {
                Value = new float3(0, 1, 0)
            }
                                    ),
                                50
                                );
        }
Пример #9
0
 /// <summary>
 ///     Add the internal <see cref="SpawnSystemList"/> to the awoken spawner if not already added.
 /// </summary>
 private void AddSpawnListToSpawnSystem(SpawnSystem self)
 {
     if (!self.m_spawnLists.Contains(SpawnList))
     {
         self.m_spawnLists.Add(SpawnList);
     }
 }
Пример #10
0
    private void OnTriggerEnter(Collider other)
    {
        if (onCooldown == true)
        {
            return;
        }
        if (other.CompareTag("Player"))
        {
            GameObject pointCorn = PlayerInventory.GetUnicorn(type);

            if (pointCorn != null)
            {
                ParticleSpawner.SpawnParticleEffect(ParticleSpawner.Particles.Delivery, particlePoint.position);
                AudioController.Instance.GenerateAudio(AudioController.ClipName.GotBallon, transform.position, gotBalloon);
                onCooldown = true;
                SpawnSystem.AddSpawnPoint(pointCorn.GetComponent <UnicornStats>().GetSpawn(), pointCorn);
                PointHandeler.SuccessfulDelivery(this, successDelay, positivePoint);
                pointCorn.GetComponent <UnicornStats>().GetPooled();
                successfulDelivery = true;
                if (coroutineRunning == true)
                {
                    StopCoroutine(delivery);
                    coroutineRunning = false;
                }
                uiElement.EndTimer();
            }
            else
            {
                AudioController.Instance.GenerateAudio(AudioController.ClipName.WrongBallon, transform.position, wrongBalloon);
            }
        }
    }
Пример #11
0
    private GameObject findSpawner;//finds spawner object

    void Awake()
    {
        anim = GetComponent<Animator>();
        _alive = true;
        findSpawner = GameObject.Find("unitSpawner");
        waveStats = findSpawner.GetComponent<SpawnSystem>();
    }
Пример #12
0
 // Start is called before the first frame update
 void Start()
 {
     ui      = GameObject.Find("UI").GetComponent <UI>();
     player  = GameObject.Find("Player").GetComponent <HP>();
     hp      = GetComponent <HP>();
     spawner = GameObject.Find("Spawner").GetComponent <SpawnSystem>();
 }
Пример #13
0
 public void SetStartMoney()
 {
     foreach (NetworkGamePlayerLobby player in Room.GamePlayers)
     {
         player.money = startMoney;
     }
     SpawnSystem.SyncMoney();
 }
Пример #14
0
    void Awake()
    {
        _findSpawner = GameObject.Find("Spawner");
        _waveStats = _findSpawner.GetComponent<SpawnSystem>();
        _findObjectSpawner = GameObject.Find("ObjectSpawner");
        _resourcesInfo = _findObjectSpawner.GetComponent<ObjectSpawner>();

    }
Пример #15
0
 void Start()
 {
     if (SpawnSystem.Instance == null)
     {
         SpawnSystem.Instance = this;
     }
     StartCoroutine(this.DoWave());
 }
Пример #16
0
 // Start is called before the first frame update
 void Start()
 {
     _BoardSystem = new BoardSystem(boardComp);
     _SpawnSystem = _SpawnSystemFactory.Create(spawnComp);
     _BoardSystem.OnCandyMatch  += _SpawnSystem.RemoveCandyList;
     _BoardSystem.OnRefillBoard += Refill;
     _BoardSystem.OnRemoveCandy += _SpawnSystem.RemoveCandy;
     //StartCoroutine(Test());
 }
Пример #17
0
 private GameObject _recourcesText;//timer object
 // Use this for initialization
 void Start()
 {
     _blockChoice = 1;
     _clearPath = true;
     _findSpawner = GameObject.Find("Spawner");
     _waveStats = _findSpawner.GetComponent<SpawnSystem>();
     _pickPos = _turretPickIcon.GetComponent<RectTransform>();
     _recourcesText = GameObject.Find("RecourcesText");//find timer object
 }
Пример #18
0
 private async Task SpawnRandomAsync(int count, int delayMs, Entity[] entityPrefas)
 {
     for (int i = 0; i < count; i++)
     {
         // Enqueue spawning (SpawnSystem and Spawn are from Reese.Spawning):
         SpawnSystem.Enqueue(MakeRandomSpawn(entityPrefas));
         await Task.Delay(delayMs);
     }
 }
Пример #19
0
 private void Start()
 {
     characters = new List <GameObject> ();
     map        = GameObject.Find("ground");
     //generatePlayers ();
     spawnController = new SpawnSystem();
     scoreController = gameObject.AddComponent <SimpleScoringSystem>();
     scoreController.Initialize();
     turnController = gameObject.AddComponent <TurnSystem>();
 }
Пример #20
0
    private GameObject _findSpawner;//finds spawner object
    //GameObjects
   

    void Awake() {
        _findSpawner = GameObject.Find("Spawner");
        _waveStats = _findSpawner.GetComponent<SpawnSystem>();

        _nodeDiameter = _nodeRadius*2;//radius = from midle to end, diameter is from end to end
        _gridSizeX = Mathf.RoundToInt(_gridSize.x/_nodeDiameter);//takes the grid and divides it by the diameter of a node to find the ammount if nodes, rounded to a int becouse we cant have hal nodes here
        _gridSizeY = Mathf.RoundToInt(_gridSize.y/_nodeDiameter);//takes the grid and divides it by the diameter of a node to find the ammount if nodes, rounded to a int becouse we cant have hal nodes here
        CreateGrid();//create the grid
        InvokeRepeating("gridRefresh", 0, .25f);//the grid gets refreshed every .25 sec, becouse every frome would be a waste of resources
	}
Пример #21
0
 public SystemManager(Game1 myGame)
 {
     this.myGame = myGame;
     // Initiate Instances
     sSelectionHandler = new SelectionHandlerSystem(myGame);
     sHealth           = new HealthSystem(myGame);
     sMovement         = new MovementSystem(myGame);
     sSpawn            = new SpawnSystem(myGame);
     sCollision        = new CollisionSystem(myGame);
 }
    [HarmonyPriority(Priority.LowerThanNormal)]  // Let other prefixes do what they want first.
    private static bool DelayUpdate(SpawnSystem __instance, bool eventSpawners)
    {
        // Ignore event spawners. Let them do what they do.
        if (eventSpawners)
        {
            return(true);
        }

        return(!WorldSpawnerManager.ShouldDelaySpawnerUpdate(__instance));
    }
Пример #23
0
 void Awake()
 {
     if (Instance)
     {
         Destroy(this);
     }
     else
     {
         Instance = this;
     }
 }
Пример #24
0
    protected SpawnSystem _waveStats;//imports spawnsystem


    public virtual void Enter ()
	{
        _findSpawner = GameObject.Find("unitSpawner");
        _waveStats = _findSpawner.GetComponent<SpawnSystem>();
        _player = GameObject.FindGameObjectWithTag("playerGoliath");
        _alertedByOther = false;
        if (_player != null)
            _targetAlive = true;
        _anim = GetComponent<Animator>();
        //print(_player.transform.position);
    }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            Spawner = Spawner ?? FindObjectOfType <SpawnSystem>();
            Client  = Client ?? GetComponentInParent <NetworkClient>();

            var pos = transform.position + transform.forward * 1.0F;
            Spawner.SpawnRequest(1, Client, pos, transform.rotation);
        }
    }
Пример #26
0
    // Start is called before the first frame update
    void Start()
    {
        onMobile = GameObject.FindGameObjectWithTag("Engine").GetComponent <Engine>().onMobile;

        spawnSystem = GameObject.FindGameObjectWithTag("Engine").GetComponent <SpawnSystem>();
        currentLife = maxLife;
        Color laserColor = Color.Lerp(GameObject.FindGameObjectWithTag("Engine").GetComponent <Engine>().playerColor, new Color(0, 0, 0, 175), 0.5f);

        laserLine.startColor = laserColor;
        laserLine.endColor   = laserColor;
    }
Пример #27
0
    void Start()
    {
        _gameManager = GameManager.Instance;

        _spawnSystem = _gameManager.Enemies;

        _coreTotalLife        = _gameManager.CoreTotalLife;
        _currentLife          = _coreTotalLife;
        _secondsToCheckMenace = _gameManager.CoreMenaceCheckPeriod;
        _lifeBar.SetUp(_coreTotalLife);
    }
Пример #28
0
 public PatchManager(SpawnSystem spawnSystem, ProcessSystem processSystem,
                     CompoundCloudSystem compoundCloudSystem, TimedLifeSystem timedLife, DirectionalLight worldLight,
                     GameProperties currentGame)
 {
     this.spawnSystem         = spawnSystem;
     this.processSystem       = processSystem;
     this.compoundCloudSystem = compoundCloudSystem;
     this.timedLife           = timedLife;
     this.worldLight          = worldLight;
     this.currentGame         = currentGame;
 }
 private static void InitSpawner(SpawnSystem __instance)
 {
     try
     {
         WorldSpawnerManager.ConfigureSpawnList(__instance);
         WorldSpawnSessionManager.StartSession(__instance);
     }
     catch (Exception e)
     {
         Log.LogError("Error during Spawn That world spawner init", e);
     }
 }
Пример #30
0
    private void Start()
    {
        hp      = GetComponent <HP>();
        rb      = GetComponent <Rigidbody2D>();
        cl      = this.GetComponent <Collider2D>();
        mc      = GameObject.Find("dot").GetComponent <mouseCursor>();
        spawner = GameObject.Find("Spawner").GetComponent <SpawnSystem>();
        trail   = GetComponent <TrailRenderer>();
        //trail.emitting = false;

        startGravityScale = rb.gravityScale;
    }
Пример #31
0
        private void ResetGame()
        {
            ComponentManager.Get().ClearComponents();

            renderingSystem          = new RenderingSystem();
            physicsSystem            = new PhysicsSystem();
            collisionDetectionSystem = new CollisionDetectionSystem();
            inputSystem = new InputSystem();
            spawnSystem = new SpawnSystem();
            textSystem  = new TextSystem();
            CreateEntities();
        }
Пример #32
0
    private void Awake()
    {
        switch (team)
        {
        case 0:
            SpawnSystem.AddSpawnPointA(transform);
            break;

        case 1:
            SpawnSystem.AddSpawnPointB(transform);
            break;
        }
    }
Пример #33
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            renderingSystem          = new RenderingSystem();
            physicsSystem            = new PhysicsSystem();
            collisionDetectionSystem = new CollisionDetectionSystem();
            inputSystem = new InputSystem();
            spawnSystem = new SpawnSystem();
            textSystem  = new TextSystem();
            scoreSystem = new ScoreSystem();
        }
Пример #34
0
        void Enqueue()
        {
            if (!IsForAgents)
            {
                var random = new Unity.Mathematics.Random((uint)new System.Random().Next());

                for (int i = 0; i < enqueueCount; ++i)
                {
                    SpawnSystem.Enqueue(new Spawn()
                                        .WithPrefab(prefabEntity)
                                        .WithComponentList(
                                            new Translation
                    {
                        Value = new float3(
                            random.NextInt(-25, 25),
                            2,
                            random.NextInt(-25, 25)
                            )
                    }
                                            )
                                        );
                }

                return;
            }

            SpawnSystem.Enqueue(new Spawn()
                                .WithPrefab(prefabEntity)
                                .WithComponentList(
                                    new NavAgent
            {
                JumpDegrees      = 45,
                JumpGravity      = 200,
                TranslationSpeed = 20,
                TypeID           = NavUtil.GetAgentType(NavConstants.HUMANOID),
                Offset           = new float3(0, 1, 0)
            },
                                    new NavNeedsSurface {
            },
                                    new Parent {
            },
                                    new LocalToParent {
            },
                                    new Translation
            {
                Value = new float3(0, 1, 0)
            }
                                    ),
                                enqueueCount
                                );
        }
Пример #35
0
    private void OnDestroy()
    {
        switch (team)
        {
        case 0:
            SpawnSystem.RemoveSpawnPointA(transform);
            break;

        case 1:
            SpawnSystem.RemoveSpawnPointB(transform);
            break;
        }
        SpawnSystem.RemoveSpawnPointA(transform);
    }
Пример #36
0
 void Awake()
 {
     if (Instance) {
         Destroy(this);
     }
     else {
         Instance = this;
     }
 }