예제 #1
0
    public override void TakeMsg(ActorModel who, EventMsg msg)
    {
        Debug.Log("trigger");
        switch (msg.Type)
        {
        case EventType.GetBumped:
            ActorModel bumper = msg.Source;
            if (bumper.Type == ThingTypes.Player)
            {
                Debug.Log("I touched player");
                TileModel loc = who.GetLocation();
                //bumper.HasKey = true;
                who.LeaveTile(who.GetLocation());
                bumper.SetLocation(loc);
                //who.View.GetComponentInChildren<SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                //who.View.transform.GetComponentInParent<TileView>().GetComponentInChildren<SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                God.C.AddAction(new GainWallAction(bumper, who));
            }
            return;

        case EventType.GetName:
            msg.Text += " KEY";
            return;

        case EventType.WallStop:
            int WallFace = Random.Range(0, 4);
            switch (WallFace)
            {
            case (0):
                God.GSM.wallLimit = 0;
                return;

            case (1):
                God.GSM.wallLimit = 1;
                return;

            case (2):
                God.GSM.wallLimit = 2;
                return;

            case (3):
                God.GSM.wallLimit = 3;
                return;
            }
            return;
        }
    }
예제 #2
0
    public override void TakeMsg(ActorModel who, EventMsg msg)
    {
        switch (msg.Type)
        {
        case EventType.GetBumped:
            ActorModel bumper = msg.Source;
            if (bumper.Type == ThingTypes.Player)
            {
                TileModel loc = who.GetLocation();
                bumper.HasKey = true;
                who.LeaveTile(who.GetLocation());
                bumper.SetLocation(loc);
                God.C.AddAction(new GainKeyAction(bumper, who));
            }
            return;

        case EventType.GetName:
            msg.Text += " KEY";
            return;
        }
    }
예제 #3
0
 public void Setup(ActorModel m)
 {
     Model           = m;
     m.View          = this;
     Body            = transform.Find("Body").GetComponent <SpriteRenderer>();
     gameObject.name = m.Type.ToString();
     if (m.Type == ThingTypes.Player)
     {
         listener = gameObject.AddComponent <AudioListener>();
         animator = gameObject.AddComponent <Animator>();
     }
     if (m.Type == ThingTypes.Monster)
     {
         if (gameObject.GetComponent <AudioSource>() == null)
         {
             //Debug.Log("Make new source");
             source = gameObject.AddComponent <AudioSource>();
         }
         else
         {
             //Debug.Log("Found Source");
             source = gameObject.GetComponent <AudioSource>();
         }
         //source = gameObject.AddComponent<AudioSource>();
         source.minDistance  = 1f;
         source.maxDistance  = 2.4f;
         source.spatialBlend = 1.0f;
         source.rolloffMode  = AudioRolloffMode.Linear;
         source.loop         = true;
         source.clip         = God.AM.monsterSnarl;
         source.Play();
     }
     if (Model.Type == ThingTypes.Wall)
     {
         GameObject wallTop;
         wallTop                         = new GameObject();
         wallTop.name                    = "WallTop";
         wallTop.transform.parent        = gameObject.transform;
         wallTop.transform.localPosition = new Vector3(0, 0, 0);
         wallTop.AddComponent <SpriteRenderer>();
         wallTop.GetComponent <SpriteRenderer>().sprite       = God.SM.wallTop;
         wallTop.GetComponent <SpriteRenderer>().sortingOrder = 6;
     }
     Body.sprite = God.Library.GetSprite(m.Type);
     if (m.Species != MonsterType.Types.None)
     {
         Body.sprite = God.Library.GetMonster(m.Species).S;
     }
     SetLocation(m.GetLocation().View);
 }
예제 #4
0
    //When I first spawn a world thing I need to run setup on it so that it does basic stuff like place itself
    public void Setup(ActorModel m)
    {
        Model           = m;
        m.View          = this;
        Body            = transform.Find("Body").GetComponent <SpriteRenderer>();
        gameObject.name = m.Type.ToString();
//        if (!God.GSM.AllThings.Contains(this))
//            God.GSM.AllThings.Add(this);
        Body.sprite = God.Library.GetSprite(m.Type);
        if (m.Species != MonsterType.Types.None)
        {
            Body.sprite = God.Library.GetMonster(m.Species).S;
        }
        SetLocation(m.GetLocation().View);
//        transform.Rotate2D(50);
    }
예제 #5
0
    public override void TakeMsg(ActorModel who, EventMsg msg)
    {
        switch (msg.Type)
        {
        case EventType.GetBumped:
            ActorModel bumper = msg.Source;
            if (bumper.Type == ThingTypes.Player)
            {
                TileModel loc = who.GetLocation();
                God.C.AddAction(new GetScoreAction(bumper, who));
                who.Despawn();
                ModelManager.ChangeScore(1);
                bumper.SetLocation(loc);
            }
            return;

        case EventType.GetName:
            msg.Text += " SCORETHING";
            return;
        }
    }
예제 #6
0
    public override void TakeMsg(ActorModel who, EventMsg msg)
    {
        bool key = false;

        switch (msg.Type)
        {
        case EventType.GetBumped:
            if (God.GSM.keyIsVisible)
            {
                ActorModel bumper = msg.Source;
                if (bumper.Type == ThingTypes.Player)
                {
                    TileModel loc = who.GetLocation();
                    bumper.HasKey = true;

                    God.GSM.hasKey = true;
                    Debug.Log("KEY IS " + key);
                    who.LeaveTile(who.GetLocation());
                    bumper.SetLocation(loc);
                    who.View.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                    who.View.transform.GetComponentInParent <TileView>().GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                    God.C.AddAction(new GainKeyAction(bumper, who));
                }
            }
            return;

        case EventType.GetName:
            msg.Text += " KEY";
            return;

        case EventType.KeyMove:
            //Debug.Log("KEY IS MOVING");
            if (!God.GSM.hasKey)
            {
                if (God.GSM.keyMovement < God.GSM.monsterRound)
                {
                    God.GSM.keyMovement++;
                }
                else if (God.GSM.keyMovement == God.GSM.monsterRound)
                {
                    int rand = Random.Range(0, 2);
                    Debug.Log(rand);
                    if (rand == 1)
                    {
                        if (who.Location.x > GameSettings.playerX)
                        {
                            who.Move(-1, 0);
                        }
                        else if (who.Location.x < GameSettings.playerX)
                        {
                            who.Move(1, 0);
                        }
                    }
                    else if (rand == 0)
                    {
                        if (who.Location.y > GameSettings.playerY)
                        {
                            who.Move(0, -1);
                        }
                        else if (who.Location.y < GameSettings.playerY)
                        {
                            who.Move(0, 1);
                        }
                    }
                    //God.GSM.AS.PlayOneShot(God.GSM.StompClip);
                    God.GSM.keyMovement = 0;
                }
            }
            return;
        }
    }
예제 #7
0
    public override void TakeMsg(ActorModel who, EventMsg msg)
    {
        switch (msg.Type)
        {
        case EventType.GetBumped:
            ActorModel bumper = msg.Source;
            if (bumper.Type == ThingTypes.Player)
            {
                if (God.GSM.scoreIsVisible)
                {
                    TileModel loc = who.GetLocation();
                    who.View.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                    who.View.transform.GetComponentInParent <TileView>().GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                    God.C.AddAction(new GetScoreAction(bumper, who));
                    who.Despawn();
                    ModelManager.ChangeScore(1);
                    bumper.SetLocation(loc);
                }
            }
            return;

        case EventType.GetName:
            msg.Text += " SCORETHING";
            return;

        case EventType.ScoreMove:
            if (God.GSM.scoreMovement < God.GSM.monsterRound)
            {
                God.GSM.scoreMovement++;
            }
            else if (God.GSM.scoreMovement == God.GSM.monsterRound)
            {
                int rand = Random.Range(0, 2);
                Debug.Log(rand);
                if (rand == 1)
                {
                    if (who.Location.x > GameSettings.playerX)
                    {
                        who.Move(-1, 0);
                    }
                    else if (who.Location.x < GameSettings.playerX)
                    {
                        who.Move(1, 0);
                    }
                }
                else if (rand == 0)
                {
                    if (who.Location.y > GameSettings.playerY)
                    {
                        who.Move(0, -1);
                    }
                    else if (who.Location.y < GameSettings.playerY)
                    {
                        who.Move(0, 1);
                    }
                }
                //God.GSM.AS.PlayOneShot(God.GSM.StompClip);
                God.GSM.scoreMovement = 0;
            }
            return;
        }
    }
예제 #8
0
    //When I first spawn a world thing I need to run setup on it so that it does basic stuff like place itself
    public void Setup(ActorModel m)
    {
        Model           = m;
        m.View          = this;
        Body            = transform.Find("Body").GetComponent <SpriteRenderer>();
        gameObject.name = m.Type.ToString();
//        if (!God.GSM.AllThings.Contains(this))
//            God.GSM.AllThings.Add(this);
        if (m.Type == ThingTypes.Player)
        {
            //Debug.Log("X is " + m.Location.x);
            //Body = transform.Find("Body").GetComponent<SpriteRenderer>();
            listener = gameObject.AddComponent <AudioListener>();
            animator = gameObject.AddComponent <Animator>();
            animator.runtimeAnimatorController = God.GSM.animator;
            //listener = transform.Find("Body").GetComponent<AudioListener>();
        }
        if (m.Type == ThingTypes.Skeleton)
        {
            source              = gameObject.AddComponent <AudioSource>();
            source.minDistance  = 1f;
            source.maxDistance  = 2.4f;
            source.spatialBlend = 1.0f;
            source.rolloffMode  = AudioRolloffMode.Linear;
            source.loop         = true;
            source.clip         = God.GSM.clip;
            source.Play();
        }
        //if (m.Type == ThingTypes.MagicDoor)
        //{
        //    source = gameObject.AddComponent<AudioSource>();
        //    source.minDistance = 1f;
        //    source.maxDistance = 1.7f;
        //    source.spatialBlend = 1.0f;
        //    source.rolloffMode = AudioRolloffMode.Linear;
        //    clip2 = God.GSM.clip2;
        //    source.PlayOneShot(clip2);
        //}
        //if (m.Type == ThingTypes.RedKey)
        //{
        //    source = gameObject.AddComponent<AudioSource>();
        //    source.minDistance = 1f;
        //    source.maxDistance = 1.7f;
        //    source.spatialBlend = 1.0f;
        //    source.rolloffMode = AudioRolloffMode.Linear;
        //    clip3 = God.GSM.clip3;
        //    source.PlayOneShot(clip3);
        //}
        //if (m.Type == ThingTypes.Wall)
        //{
        //    source = gameObject.AddComponent<AudioSource>();
        //    source.minDistance = 1f;
        //    source.maxDistance = 1.7f;
        //    source.spatialBlend = 1.0f;
        //    source.rolloffMode = AudioRolloffMode.Linear;
        //    clip4 = God.GSM.clip4;
        //    source.PlayOneShot(clip4);
        //}
        Body.sprite = God.Library.GetSprite(m.Type);
        if (m.Species != MonsterType.Types.None)
        {
            Body.sprite = God.Library.GetMonster(m.Species).S;
        }
        SetLocation(m.GetLocation().View);
//        transform.Rotate2D(50);
    }