예제 #1
0
 private void OnEnemyKilledEvent(Centipede centipede)
 {
     Debug.Log("You killed centipede!!!!!!!!!!");
     // add the score value for the enemy to the player score
     playerScore += centipede.ScoreValue;
     UpdateScore();
 }
예제 #2
0
    // Use this for initialization
    private void Awake()
    {
        SegmentBody segInfo = new SegmentBody();

        // Timer for generating segments
        timerMax     = 0.8f;
        timer        = timerMax;
        spriteRender = GetComponent <SpriteRenderer>();

        // Find length from center of player's ship to border
        boxCollider2D = GetComponent <BoxCollider2D>();
        Vector3 pos = transform.position;

        leftradius  = pos.x - boxCollider2D.bounds.min.x;
        upperradius = pos.y - boxCollider2D.bounds.min.y;

        spriteRender = GetComponent <SpriteRenderer>();

        centipede = Resources.Load <Centipede>("Centipede");
        mushrooms = Resources.Load <Mushrooms>("Mushroom");
        bullet    = Resources.Load <Bullet>("Bullet");
        wizard    = Resources.Load <Wizard>("Wizard");
        Debug.Log("Centipede_Panimatstarted");

        //levelGrid = new LevelGrid(10, 10);

        GetCameraSizes();

        newWizard = Instantiate(wizard);
    }
예제 #3
0
 private static void Centipede_BitByPlayer(On.Centipede.orig_BitByPlayer orig, Centipede self, Creature.Grasp grasp, bool eu)
 {
     orig.Invoke(self, grasp, eu);
     for (int i = 0; i < 2; i++)
     {
         self.room.AddObject(new BloodParticle(self.bodyChunks[0].pos, new Vector2(UnityEngine.Random.Range(-3f, 3f), UnityEngine.Random.Range(1f, 5f)), BloodMod.creatureColors["SmallCentipede"], "SmallCentipede", null, 1.3f));
     }
 }
    private void SpawnCentipede(Vector2 position)
    {
        Centipede centipede = new Centipede();

        centipede.Init();
        centipede.CreateCentipede(position, _centipedeBodyLength);

        _centipedesList.Add(centipede);
    }
    public void CreateNewCentipede(GameObject headGameObject, Vector2 lastPosition, List <CentipedeTail> remainingTail,
                                   HorizontalDirection horizontalDirection, VerticalDirection verticalDirection)
    {
        CentipedeCount += 1;
        Centipede centipede = new Centipede();

        centipede.Init();

        centipede.CreateCentipede(headGameObject, lastPosition, remainingTail, horizontalDirection, verticalDirection);
        _centipedesList.Add(centipede);
    }
예제 #6
0
        public void UpdateCentipede(Centipede _centipede)
        {
            UpdateScore();
            _CentipedeList.Remove(_centipede);

            if (_CentipedeList.Count <= 0)
            {
                DisplayGameOver(true);
                return;
            }
        }
예제 #7
0
    private void OnCollisionEnter(Collision coll)
    {
        GameObject colobj = coll.gameObject;

        if (colobj.name == "shot(Clone)")
        {
            Damage();
        }
        if (colobj.name == "head2(Clone)")
        {
            cen = GameObject.Find("GameManager").GetComponent(typeof(Centipede)) as Centipede;
            Death();
        }
    }
예제 #8
0
    // Creates segment of centipede
    private void CreateCentipede()
    {
        Vector3 position = transform.position;

        position.x = 0;
        position.y = maxY - 0.2f;
        Centipede newCentipede = Instantiate(centipede, position, centipede.transform.rotation);

        SegmentBody.centipede.Add(newCentipede);
        segments--;
        timer = 0.2f;
        if (segments == 0)
        {
            isAlive = true;
        }
    }
예제 #9
0
 private void CentiShockHook(On.Centipede.orig_Shock orig, Centipede self, PhysicalObject shockObj)
 {
     if (shockObj is Player && (shockObj as Player).playerState.slugcatCharacter == PlayerManager.GetCustomPlayer("Electric").SlugcatIndex)
     {
         if (self.graphicsModule != null)
         {
             (self.graphicsModule as CentipedeGraphics).lightFlash = 1f;
             for (int i = 0; i < (int)Mathf.Lerp(4f, 8f, self.size); i++)
             {
                 self.room.AddObject(new Spark(self.HeadChunk.pos, Custom.RNV() * Mathf.Lerp(4f, 14f, UnityEngine.Random.value), new Color(0.7f, 0.7f, 1f), null, 8, 14));
             }
         }
         for (int j = 0; j < self.bodyChunks.Length; j++)
         {
             self.bodyChunks[j].vel += Custom.RNV() * 6f * UnityEngine.Random.value;
             self.bodyChunks[j].pos += Custom.RNV() * 6f * UnityEngine.Random.value;
         }
         for (int k = 0; k < shockObj.bodyChunks.Length; k++)
         {
             shockObj.bodyChunks[k].vel += Custom.RNV() * 6f * UnityEngine.Random.value;
             shockObj.bodyChunks[k].pos += Custom.RNV() * 6f * UnityEngine.Random.value;
         }
         for (int i = 0; i < EVars.Count; i++)
         {
             if (EVars[i].ply == (shockObj as Player))
             {
                 if (self.Red)
                 {
                     EVars[i].EnterChargedModeNoToll();
                 }
                 else
                 {
                     EVars[i].EnterChargedModeNoToll();
                     self.Die();
                 }
             }
         }
     }
     else
     {
         orig.Invoke(self, shockObj);
     }
 }
예제 #10
0
    public override void ReceiveDamage()
    {
        try
        {
            if (SegmentBody.centipede[segmentNumber + 1] != null)
            {
                Centipede CurrentSegment = (Centipede)SegmentBody.centipede[segmentNumber + 1];
                CurrentSegment.spriteRenderer.sprite = Resources.Load <Sprite>("Centipede");
            }
        }
        catch (Exception exception)
        {
            Debug.Log(exception.ToString());
        }

        Vector3   position     = transform.position;
        Mushrooms newMushrooms = Instantiate(mushrooms, position, mushrooms.transform.rotation);

        GameHandler.score += (GameHandler.wave * 2);
        GameHandler.livingSegments--;
        base.ReceiveDamage();
    }
예제 #11
0
	// Use this for initialization
	void Start () {
		cObj = gameObject.GetComponent<Centipede>();
	}
예제 #12
0
 private void HandleEnemyKilledEvent(Centipede centipede)
 {
     playerScore += centipede.ScoreValue;  // public property
     Debug.Log("Score :" + playerScore);
     UpdateScore();
 }
    public override void Realize()
    {
        if (realizedCreature != null)
        {
            return;
        }
        switch (creatureTemplate.TopAncestor().type)
        {
        case CreatureTemplate.Type.Slugcat:
            realizedCreature = new Player(this, world);
            break;

        case CreatureTemplate.Type.LizardTemplate:
            realizedCreature = new Lizard(this, world);
            break;

        case CreatureTemplate.Type.Fly:
            realizedCreature = new Fly(this, world);
            break;

        case CreatureTemplate.Type.Leech:
            realizedCreature = new Leech(this, world);
            break;

        case CreatureTemplate.Type.Snail:
            realizedCreature = new Snail(this, world);
            break;

        case CreatureTemplate.Type.Vulture:
            realizedCreature = new Vulture(this, world);
            break;

        case CreatureTemplate.Type.GarbageWorm:
            GarbageWormAI.MoveAbstractCreatureToGarbage(this, Room);
            realizedCreature = new GarbageWorm(this, world);
            break;

        case CreatureTemplate.Type.LanternMouse:
            realizedCreature = new LanternMouse(this, world);
            break;

        case CreatureTemplate.Type.CicadaA:
            realizedCreature = new Cicada(this, world, creatureTemplate.type == CreatureTemplate.Type.CicadaA);
            break;

        case CreatureTemplate.Type.Spider:
            realizedCreature = new Spider(this, world);
            break;

        case CreatureTemplate.Type.JetFish:
            realizedCreature = new JetFish(this, world);
            break;

        case (CreatureTemplate.Type)patch_CreatureTemplate.Type.SeaDrake:
            realizedCreature = new SeaDrake(this, world);
            break;

        case CreatureTemplate.Type.BigEel:
            realizedCreature = new BigEel(this, world);
            break;

        case CreatureTemplate.Type.Deer:
            realizedCreature = new Deer(this, world);
            break;

        case (CreatureTemplate.Type)patch_CreatureTemplate.Type.WalkerBeast:
            realizedCreature = new WalkerBeast(this, world);
            break;

        case CreatureTemplate.Type.TubeWorm:
            realizedCreature = new TubeWorm(this, world);
            break;

        case CreatureTemplate.Type.DaddyLongLegs:
            realizedCreature = new DaddyLongLegs(this, world);
            break;

        case CreatureTemplate.Type.TentaclePlant:
            if (creatureTemplate.type == CreatureTemplate.Type.TentaclePlant)
            {
                realizedCreature = new TentaclePlant(this, world);
            }
            else
            {
                realizedCreature = new PoleMimic(this, world);
            }
            break;

        case CreatureTemplate.Type.MirosBird:
            realizedCreature = new MirosBird(this, world);
            break;

        case CreatureTemplate.Type.TempleGuard:
            realizedCreature = new TempleGuard(this, world);
            break;

        case CreatureTemplate.Type.Centipede:
        case CreatureTemplate.Type.RedCentipede:
        case CreatureTemplate.Type.Centiwing:
        case CreatureTemplate.Type.SmallCentipede:
            realizedCreature = new Centipede(this, world);
            break;

        case CreatureTemplate.Type.Scavenger:
            realizedCreature = new Scavenger(this, world);
            break;

        case CreatureTemplate.Type.Overseer:
            realizedCreature = new Overseer(this, world);
            break;

        case CreatureTemplate.Type.VultureGrub:
            if (creatureTemplate.type == CreatureTemplate.Type.VultureGrub)
            {
                realizedCreature = new VultureGrub(this, world);
            }
            else if (creatureTemplate.type == CreatureTemplate.Type.Hazer)
            {
                realizedCreature = new Hazer(this, world);
            }
            break;

        case CreatureTemplate.Type.EggBug:
            realizedCreature = new EggBug(this, world);
            break;

        case CreatureTemplate.Type.BigSpider:
        case CreatureTemplate.Type.SpitterSpider:
            realizedCreature = new BigSpider(this, world);
            break;

        case CreatureTemplate.Type.BigNeedleWorm:
            if (creatureTemplate.type == CreatureTemplate.Type.SmallNeedleWorm)
            {
                realizedCreature = new SmallNeedleWorm(this, world);
            }
            else
            {
                realizedCreature = new BigNeedleWorm(this, world);
            }
            break;

        case CreatureTemplate.Type.DropBug:
            realizedCreature = new DropBug(this, world);
            break;
        }
        InitiateAI();
        for (int i = 0; i < stuckObjects.Count; i++)
        {
            if (stuckObjects[i].A.realizedObject == null)
            {
                stuckObjects[i].A.Realize();
            }
            if (stuckObjects[i].B.realizedObject == null)
            {
                stuckObjects[i].B.Realize();
            }
        }
    }
 public void RemoveCentipede(Centipede centipede)
 {
     _centipedesList.Remove(centipede);
 }