예제 #1
0
파일: Player.cs 프로젝트: teonistor/ggj20
    void OnTriggerEnter2D(Collider2D other)
    {
        if (ouHeld != null)
        {
            if (other.gameObject.layer == nestLayer && ouHeld.pairColor == other.GetComponent <Nest>().pairColor)
            {
                couldHatch = true;
            }
        }

        else if (other.gameObject.layer == ouLayer)
        {
            Ou otherOu = other.GetComponent <Ou>();

            if (!otherOu.isHeld)
            {
                if (otherOu.owner == null || otherOu.owner == this)
                {
                    if (hatchlingHeld == null)
                    {
                        ouHeld = otherOu;
                        ouHeld.GrabHold(this);
                        ouHeld.transform.localPosition = carryPosition;
                    }
                }
                else
                {
                    Destroy(other.gameObject);
                    if (stunIndicatorInProgress == null)
                    {
                        stunIndicatorInProgress        = Instantiate(stunIndicator, transform, false).GetComponent <StunIndicator>();
                        stunIndicatorInProgress.player = this;
                    }
                    if (hatchlingHeld != null)
                    {
                        Destroy(hatchlingHeld.gameObject);
                        hatchlingHeld = null;
                    }
                }
            }
        }

        if (hatchlingHeld != null)
        {
            if (other.gameObject.layer == houseLayer)
            {
                if (other.GetComponent <House>().pairColor == hatchlingHeld.pairColor)
                {
                    score += scoreGainOnMatching;
                }
                else
                {
                    score += scoreGainOnNonmatching;
                }
                Destroy(hatchlingHeld.gameObject);
                hatchlingHeld = null;
            }
        }
    }
예제 #2
0
파일: Player.cs 프로젝트: teonistor/ggj20
 internal void HatcingComplete()
 {
     hatchIndicatorInProgress = null;
     Destroy(ouHeld.gameObject);
     ouHeld        = null;
     hatchlingHeld = Instantiate(hatchling, transform).GetComponent <Hatchling>();
     hatchlingHeld.transform.localPosition = carryPosition;
     couldHatch = false;
     audio.PlayOneShot(hatched);
 }
예제 #3
0
            protected override void OnTick()
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                Mobile spawn;

                spawn = new Hatchling();

                spawn.MoveToWorld(m_Item.Location, m_Item.Map);

                m_Item.Delete();
            }
예제 #4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            reader.ReadInt();

            Hatchling = reader.ReadMobile() as BaseCreature;

            if (Hatchling != null)
            {
                Hatchling.Delete();
            }

            if (Egg != null && !Egg.Visible)
            {
                Egg.Visible = true;
            }

            FocusList = new List <Mobile>();
        }
예제 #5
0
            protected override void OnTick()
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                Mobile spawn;
                Mobile spawn2;
                Mobile spawn3;

                switch (Utility.Random(1))
                {
                default:
                case 0: spawn = new Hatchling(); spawn2 = new Hatchling(); spawn3 = new Hatchling(); break;
                }

                spawn.MoveToWorld(m_Item.Location, m_Item.Map);
                spawn2.MoveToWorld(m_Item.Location, m_Item.Map);
                spawn3.MoveToWorld(m_Item.Location, m_Item.Map);

                m_Item.Delete();
            }