Ejemplo n.º 1
0
        public Player(Vector2 position) : base()
        {
            attachedObject            = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/PlayerObject"), new Vector2(position.x, position.y), Quaternion.identity);
            objectScript              = attachedObject.GetComponent <PlayerObject>();
            objectScript.linkedScript = this;
            attachedObject.GetComponent <Identifier>().linkedScript = this;
            StatesList.Add("active", typeof(ActiveState));
            StatesList.Add("launched", typeof(LaunchedState));
            StatesList.Add("stunned", typeof(StunnedState));

            state = (State)Activator.CreateInstance(StatesList["active"]);

            //TODO: DO THIS BETTER LATER 1 (cont on "2")
            targets.Add(typeof(Grunt));
            targets.Add(typeof(Chaser));

            mass = 10;

            //VERY VERY PLACEHOLDER OBJECT FINDING
            anchor     = attachedObject.transform.GetChild(0).gameObject;
            hook       = anchor.transform.GetChild(0).gameObject;
            hookSource = anchor.transform.GetChild(1).gameObject;
            hookNodes.Add(anchor.transform.GetChild(2).gameObject);
            hookNodes.Add(anchor.transform.GetChild(3).gameObject);
            hookNodes.Add(anchor.transform.GetChild(4).gameObject);
            hookNodes.Add(anchor.transform.GetChild(5).gameObject);
            hookNodes.Add(anchor.transform.GetChild(6).gameObject);
            hookNodes.Add(anchor.transform.GetChild(7).gameObject);
            hookNodes.Add(anchor.transform.GetChild(8).gameObject);
            hookNodes.Add(anchor.transform.GetChild(9).gameObject);
            hookNodes.Add(anchor.transform.GetChild(10).gameObject);
            hookNodes.Add(anchor.transform.GetChild(11).gameObject);
            hookNodes.Add(anchor.transform.GetChild(12).gameObject);
            hookNodes.Add(anchor.transform.GetChild(13).gameObject);
            hookNodes.Add(anchor.transform.GetChild(14).gameObject);
            hookNodes.Add(anchor.transform.GetChild(15).gameObject);
            hookNodes.Add(anchor.transform.GetChild(16).gameObject);
            hookNodes.Add(anchor.transform.GetChild(17).gameObject);

            hookStatesList.Add(new HookLoadedState());
            foreach (GameObject i in hookNodes)
            {
                currentNodePositions.Add(i.transform.position);
            }

            hookSize           = hook.GetComponent <CircleCollider2D>().radius;
            Stats["moveSpeed"] = 20;
            Stats["damage"]    = 5;
            Stats["maxHealth"] = 30;
            Stats["health"]    = Stats["maxHealth"];
        }
Ejemplo n.º 2
0
        public Chaser(Vector2 position)
        {
            attachedObject            = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/ChaserObject"), position, Quaternion.identity);
            objectScript              = attachedObject.GetComponent <ChaserObject>();
            objectScript.linkedScript = this;
            attachedObject.GetComponent <Identifier>().linkedScript = this;
            StatesList.Add("active", typeof(ChaserActiveState));
            StatesList.Add("launched", typeof(EnemyLaunchedState));
            StatesList.Add("stunned", typeof(EnemyStunnedState));

            state = (State)Activator.CreateInstance(StatesList["active"]);

            //BEHAVIOUR VALUES
            mass             = 5;
            decisionTimerMax = 1.5f;
            attackRadius     = 2.5f;

            //STATS
            Stats["maxHealth"] = 8;
            Stats["moveSpeed"] = 15;
            Stats["damage"]    = 3;
            Stats["health"]    = Stats["maxHealth"];
        }
Ejemplo n.º 3
0
        public void Add <T>(T model)
        {
            var theType = model.GetType().Name;

            switch (theType)
            {
            case "User": UsersList.Add(model as User); return;

            case "News": NewsesList.Add(model as Dal.Models.News); return;

            case "Category": CategoriesList.Add(model as Category); return;

            case "Magazine": MagazinesList.Add(model as Magazine); return;

            case "SmartLink": SmartLinksList.Add(model as SmartLink); return;

            case "Comment": CommentsList.Add(model as Comment); return;

            case "Visit": VisitsList.Add(model as Visit); return;

            case "NewsLetter": NewsLettersList.Add(model as NewsLetter); return;

            case "Slider": SlidersList.Add(model as Slider); return;

            case "Slide": SlidesList.Add(model as Slide); return;

            case "UserMagazine": UserMagazinesList.Add(model as UserMagazine); return;

            case "State": StatesList.Add(model as State); return;

            case "City": CitiesList.Add(model as City); return;

            case "Media": MediasList.Add(model as Media); return;

            case "Report": ReportsList.Add(model as Report); return;

            case "Vote": VotesList.Add(model as Vote); return;

            case "Advertise": AdvertisesList.Add(model as Advertise); return;

            case "AdCategory": AdCategoriesList.Add(model as AdCategory); return;

            case "Galery": GaleriesList.Add(model as Galery); return;

            case "GaleryImage": GaleryImagesList.Add(model as GaleryImage); return;

            case "Image": ImagesList.Add(model as Image); return;

            case "KeyPoint": KeyPointsList.Add(model as KeyPoint); return;

            case "KeyPointsContainer": KeyPointsContainersList.Add(model as KeyPointsContainer); return;

            case "Quiz": QuizesList.Add(model as Quiz); return;

            case "Question": QuestionsList.Add(model as Question); return;

            case "Answer": AnswersList.Add(model as Answer); return;

            case "Option": OptionList.Add(model as Option); return;

            case "ItemList": ItemsListList.Add(model as ItemList); return;

            default: throw new Exception("The type " + theType + " is not supported.");
            }
        }