예제 #1
0
        public override void _Ready()
        {
            var size = GetViewportRect().Size;

            foreach (var _ in Enumerable.Range(0, 20))
            {
                var mover    = new SimpleMover(SimpleMover.WrapModeEnum.Bounce);
                var bodySize = (float)GD.RandRange(20, 40);
                var xPos     = (float)GD.RandRange(bodySize, size.x - bodySize);
                var yPos     = (float)GD.RandRange(bodySize, size.y - bodySize);
                mover.MeshSize = new Vector2(bodySize, bodySize);
                mover.Mass     = bodySize;
                mover.Position = new Vector2(xPos, yPos);

                var repeller = new Repeller()
                {
                    Visible = false
                };
                mover.AddChild(repeller);

                var mouseAttractor = new MouseAttractor()
                {
                    Visible = false
                };
                AddChild(mouseAttractor);

                AddChild(mover);
            }
        }
예제 #2
0
 void Start()
 {
     mirror       = GetComponent <Mirror> ();
     health       = GetComponent <Health> ();
     repeller     = GetComponent <Repeller> ();
     invulnerable = false;
 }
예제 #3
0
 new void Start()
 {
     repeller      = new Repeller(repellerAnim, 15f);
     shieldAction += OnShieldDamage;
     directedShield.GetOnDamaged().AddListener(shieldAction);
     directedShield.SetSpace(GetSpace());
     base.Start();
 }
예제 #4
0
    new protected void Start()
    {
        repeller = new Repeller(repellerAnim, repellerRadius);
        brothers.AddLast(this);
        currentNode = brothers.Last;

        SetGravityVariable(10);
        SetBodyVelocity(-transform.position.normalized);
        IncreaseBodyVelocity(new Vector2(Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f)));

        base.Start();
    }
예제 #5
0
    new private void Start()
    {
        repeller = new Repeller(repellerAnim, 30f);
        AudioManager.AM.Play(bossThemeName);
        SetGravityVariable(3);

        // Movement Setup
        loopAround         = new LoopAround(75f);
        transform.position = new Vector2(70, 1);
        CutterEnemy.boss   = true;

        base.Start();
    }
예제 #6
0
    public void SpawnCollectibles()
    {
        if (worldContainer.transform.FindChild(containerName))
        {
            Destroy(collectibleContainer);
        }

        collectibleContainer = new GameObject("Collectibles");
        collectibleContainer.transform.SetParent(worldContainer.transform);

        for (int i = 0; i < numberLamp; i++)
        {
            GameObject spawnedLamp;
            spawner.SpawnRandom(lampPrefab, collectibleContainer.transform, out spawnedLamp);
            Lamp lamp = spawnedLamp.gameObject.GetComponent <Lamp>();
            lamp.PickupEvent  += OnPickupEvent;
            lamp.DroppedEvent += OnDroppedEvent;
            collectibles.Add(lamp);
        }
        for (int i = 0; i < numberAttractors; i++)
        {
            GameObject spawnedAttractor;
            spawner.SpawnRandom(attractorPrefab, collectibleContainer.transform, out spawnedAttractor);
            Attractor attractor = spawnedAttractor.gameObject.GetComponent <Attractor>();
            attractor.PickupEvent  += OnPickupEvent;
            attractor.DroppedEvent += OnDroppedEvent;
            collectibles.Add(attractor);
        }
        for (int i = 0; i < numberRepellers; i++)
        {
            GameObject spawnedRepeller;
            spawner.SpawnRandom(repellerPrefab, collectibleContainer.transform, out spawnedRepeller);
            Repeller repeller = spawnedRepeller.gameObject.GetComponent <Repeller>();
            repeller.PickupEvent  += OnPickupEvent;
            repeller.DroppedEvent += OnDroppedEvent;
            collectibles.Add(repeller);
        }
    }