コード例 #1
0
ファイル: BlockSkill.cs プロジェクト: dmsrlsla/KnightMare
    private void OnTriggerEnter(Collider other)
    {
        if (END == true)
        {
            return;
        }

        eTeamType casterCharacterTeam = (eTeamType)OWNER.GetData(ConstValue.ActorData_Team);

        if (casterActor.IS_SUPERARMOR == false)
        {
            return;
        }

        if (other.gameObject.GetComponent <TeamObject>().TEAM_TYPE
            != casterCharacterTeam)
        {
            GameObject colObject   = other.gameObject;
            BaseObject actorObject = colObject.GetComponent <BaseObject>();


            // 플레이어 차징어택 정지.

            if (other.tag == "Player")

            {
                Vector3 moveDir = other.transform.position - gameObject.transform.position;
                other.gameObject.GetComponent <Player>().Stun();
            }
        }
    }
コード例 #2
0
        public void addWalk(Walker walker, DateTime Date, OWNER Owner, int Duration)
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    DogRepository dogRepo    = new DogRepository();
                    List <Dog>    allDogs    = dogRepo.GetAllDogs();
                    List <Dog>    ownersDogs = dogRepo.GetDogByOwner(Owner.Id);

                    foreach (var d in ownersDogs)
                    {
                        cmd.CommandText = @"
                        INSERT INTO Walks (Date, Duration, WalkerId, DogId)
                        OUTPUT INSERTED.Id
                        VALUES (@Date,  @Duration, @WalkerId, @DogId)";
                        cmd.Parameters.Add(new SqlParameter("@Date", Date));
                        cmd.Parameters.Add(new SqlParameter("@Duration", Duration));
                        cmd.Parameters.Add(new SqlParameter("@WalkerId", walker.Id));
                        cmd.Parameters.Add(new SqlParameter("@DogId", d.Id));

                        int id = (int)cmd.ExecuteScalar();
                    }
                }
            }
        }
コード例 #3
0
        public void addNewOwner()
        {
            ctx = new AutoDBEntities();
            int id = findIdOfOwner();

            if (id != 0)
            {
                return;
            }
            a = new OWNER();
            if (Egn.Length != 10)
            {
                MessageBox.Show("EGN ERROR!"); return;
            }
            a.NAME = Name1;

            a.EGN = Egn;
            if (Adress.Length > 20 && Adress.Length != 0)
            {
                MessageBox.Show("ADRESS ERROR!"); return;
            }
            a.ADDRESS = Adress;
            idd       = generateID();
            //  a.ID = idd;
            ctx.OWNERS.Add(a);

            ctx.SaveChanges();
            ctx.Dispose();
        }
コード例 #4
0
ファイル: MeleeSkill.cs プロジェクト: dmsrlsla/KnightMare
    public override void InitSkill()
    {
        //Debug.LogError("");
        //player = GameManager.Instance.PlayerActor;
        casterCharacterTeam = (eTeamType)OWNER.GetComponent <BaseObject>().GetData(ConstValue.ActorData_Team);
        casterActor         = OWNER.GetComponent <BaseObject>().GetData(ConstValue.ActorData_GetThisActor) as Actor;

        switch (casterActor.TEMPLATE_KEY)
        {
        case "CHARACTER_1":
        {
            EndTime = 0.5f;
        }
        break;

        case "ENEMY_1":
        {
            EndTime      = 0.5f;
            bNormalEnemy = true;
        }
        break;

        case "ENEMY_3":
        {
            EndTime     = 0.05f;
            bGiantEnemy = true;
        }
        break;
        }
    }
コード例 #5
0
        /// <summary>
        /// Creates a TBBall at starting_offset, given some direction given by angle
        /// </summary>
        /// <param name="angle">Determines direction ball is fired off at, 0 == straight up, 180degrees = straight down, etc</param>
        /// <param name="starting_offset">Initial position of ball</param>
        public TBBall(float angle, Vector2 starting_offset)
        {
            /* given some angle, we will generate our position as a rotation
             * from the starting location */
            float temp_radius = 1.0f;
            Position = starting_offset;
            owner = OWNER.NONE;
            overlay = new RectangleOverlay(new Rectangle((int)Position.X, (int)Position.Y, (int)(128.0f * .3), (int)(128.0F * .3)), Color.Green, Arena.Screens.TrailBlazer.gDevice);
            /* maybe we can choose random between -1 and 1 for both x and y, then normalize? */
            //float x = Utility.MathFunctions.RandomFromRange(-1.0f, 1.0f, r);
            //float y = Utility.MathFunctions.RandomFromRange(-1.0f, 1.0f, r);

            //direction = new Vector2(x, y);
            //direction.Normalize();

            var angl = r.NextDouble() * Math.PI * 2.0f;
            direction = new Vector2((float)Math.Cos(angl), (float)Math.Sin(angl));

            direction.Normalize();

            particle_effect_id = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("BallOfLight", Screens.TrailBlazer.content);

            /* One "glitch" from the particle engine is the first update will be wonky due to Interpolation
             * between LastLocation and Location, so we will fix that by setting both Location and LastLocation to starting_offset
             * difference is negligble, but let's be thorough */

            ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.Location = starting_offset;
            ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.LastLocation = starting_offset;
            /* Finally, we need to start generating particles asap */
            ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Generating = true;
        }
コード例 #6
0
    private void OnTriggerEnter(Collider other)
    {
        if (END == true)
        {
            return;
        }

        if (other.gameObject.GetComponent <TeamObject>().TEAM_TYPE != casterCharacterTeam &&
            TEMP_OFF == false)
        {
            GameObject colObject   = other.gameObject;
            BaseObject actorObject = colObject.GetComponent <BaseObject>();

            TeamObject Target = other.gameObject.GetComponent <TeamObject>();
            casterActor.ThrowEvent(ConstValue.ActorData_SetTarget, Target);

            //스킬이 생성될 때 타켓을 정해주는데, throw이벤트로 타겟을 정해주는 것은 그 후임.
            SkillManager.Instance.makeSkill.TARGET = SkillManager.Instance.makeSkill.OWNER.GetData(ConstValue.ActorData_GetTarget) as BaseObject;


            if (actorObject != TARGET)
            {
                return;
            }

            TARGET.ThrowEvent(ConstValue.EventKey_Hit,
                              OWNER.GetData(ConstValue.ActorData_Character),
                              SKILL_TEMPLATE, casterActor.CUR_BUFF, casterActor.transform.rotation);
        }
    }
コード例 #7
0
    private void OnTriggerEnter(Collider other)
    {
        if (END == true)
        {
            return;
        }
        if (bFire == false)
        {
            return;
        }

        Actor casterActor = OWNER.GetData(ConstValue.ActorData_GetThisActor) as Actor;

        GameObject colObject   = other.gameObject;
        BaseObject actorObject = colObject.GetComponent <BaseObject>();

        if (actorObject != TARGET)
        {
            return;
        }

        TARGET.ThrowEvent(ConstValue.EventKey_Hit,
                          OWNER.GetData(ConstValue.ActorData_Character),
                          SKILL_TEMPLATE, casterActor.CUR_BUFF, casterActor.transform.rotation);
        END = true;
    }
コード例 #8
0
        public ActionResult DeleteConfirmed(string id)
        {
            OWNER oWNER = db.OWNER.Find(id);

            db.OWNER.Remove(oWNER);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #9
0
    public override void InitSkill()
    {
        casterCharacterTeam = (eTeamType)OWNER.GetComponent <BaseObject>().GetData(ConstValue.ActorData_Team);
        casterActor         = (Actor)OWNER.GetComponent <BaseObject>().GetData(ConstValue.ActorData_GetThisActor);
        casterAIScript      = casterActor.GetComponentInChildren <GiantEnemy>();

        TEMP_OFF = false;
    }
コード例 #10
0
 public ActionResult Edit([Bind(Include = "OwnerID,OwnerName")] OWNER oWNER)
 {
     if (ModelState.IsValid)
     {
         db.Entry(oWNER).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(oWNER));
 }
コード例 #11
0
        public ActionResult Create([Bind(Include = "OwnerID,OwnerName")] OWNER oWNER)
        {
            if (ModelState.IsValid)
            {
                db.OWNER.Add(oWNER);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(oWNER));
        }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "OWNER_ID,OWNER_SURNAME,OWNER_NAME,OWNER_PATRONYMIC,ID_DISTRICT,ID_STREET,NUM_HOUSE,NUM_APARTMENT,NUM_PHONE")] OWNER oWNER)
 {
     if (ModelState.IsValid)
     {
         db.Entry(oWNER).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_DISTRICT = new SelectList(db.DISTRICT, "DISTRICT_ID", "DISTRICT_NAME", oWNER.ID_DISTRICT);
     ViewBag.ID_STREET   = new SelectList(db.STREET, "STREET_ID", "STREET_NAME", oWNER.ID_STREET);
     return(View(oWNER));
 }
コード例 #13
0
        public TBBall(Vector2 direction_override, Vector2 start)
        {
            Position = start;
            direction = direction_override;
            owner = OWNER.NONE;
            overlay = new RectangleOverlay(new Rectangle((int)Position.X, (int)Position.Y, (int)(128.0f * .3), (int)(128.0F * .3)), Color.Green, Arena.Screens.TrailBlazer.gDevice);

            particle_effect_id = ArenaParticleEngine.ParticleEngine.Instance.LoadFromFile("BallOfLight", Screens.TrailBlazer.content);
            ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.Location = start;
            ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Emitter.LastLocation = start;
            /* Finally, we need to start generating particles asap */
            ArenaParticleEngine.ParticleEngine.Instance.systems[particle_effect_id].effects[0].Generating = true;
        }
コード例 #14
0
        // GET: OWNERs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OWNER oWNER = db.OWNER.Find(id);

            if (oWNER == null)
            {
                return(HttpNotFound());
            }
            return(View(oWNER));
        }
コード例 #15
0
        // GET: OWNERs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OWNER oWNER = db.OWNER.Find(id);

            if (oWNER == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ID_DISTRICT = new SelectList(db.DISTRICT, "DISTRICT_ID", "DISTRICT_NAME", oWNER.ID_DISTRICT);
            ViewBag.ID_STREET   = new SelectList(db.STREET, "STREET_ID", "STREET_NAME", oWNER.ID_STREET);
            return(View(oWNER));
        }
コード例 #16
0
ファイル: Planet.cs プロジェクト: dspray95/starlane
    public void SetOwner(OWNER owner)
    {
        this.owner = owner;
        Transform glowplane = transform.GetChild(0).transform.GetChild(0);

        if (owner == OWNER.PLAYER)
        {
            glowplane.gameObject.GetComponent <Renderer>().material.color = Color.cyan;
        }
        else if (owner == OWNER.AI1)
        {
            glowplane.gameObject.GetComponent <Renderer>().material.color = Color.red;
        }

        foreach (Starlane sl in starlanes)
        {
            sl.UpdateColors();
        }
    }
コード例 #17
0
ファイル: MeleeSkill.cs プロジェクト: dmsrlsla/KnightMare
    private void OnTriggerEnter(Collider other)
    {
        if (END == true)
        {
            return;
        }

        if (other.gameObject.tag != "Obstacle")
        {
            if (other.gameObject.GetComponent <Actor>().TEMPLATE_KEY == "ENEMY_1")
            {
                other.gameObject.GetComponent <NonPlayer>().AI.IS_SKILL = false;
            }
        }

        if (other.gameObject.GetComponent <TeamObject>().TEAM_TYPE != casterCharacterTeam ||
            (bGiantEnemy &&
             other.gameObject.GetComponent <Actor>() != casterActor))
        {
            GameObject colObject   = other.gameObject;
            BaseObject actorObject = colObject.GetComponent <BaseObject>();

            TeamObject Target = other.gameObject.GetComponent <TeamObject>();
            casterActor.ThrowEvent(ConstValue.ActorData_SetTarget, Target);

            //스킬이 생성될 때 타켓을 정해주는데, throw이벤트로 타겟을 정해주는 것은 그 후임.
            SkillManager.Instance.makeSkill.TARGET = SkillManager.Instance.makeSkill.OWNER.GetData(ConstValue.ActorData_GetTarget) as BaseObject;


            if (actorObject != TARGET)
            {
                return;
            }


            //Destroy(other.gameObject);

            TARGET.ThrowEvent(ConstValue.EventKey_Hit,
                              OWNER.GetData(ConstValue.ActorData_Character),
                              SKILL_TEMPLATE, casterActor.CUR_BUFF, casterActor.transform.rotation);
        }
    }
コード例 #18
0
        public void AddOwner(OWNER owner)
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"
                        INSERT INTO OWNER (Name, Phone, Address, NeighborhoodId)
                        OUTPUT INSERTED.Id
                        VALUES (@Name, @Phone, @Address,  @NeighborhoodId)";
                    cmd.Parameters.Add(new SqlParameter("@Name", owner.Name));
                    cmd.Parameters.Add(new SqlParameter("@Phone", owner.Phone));
                    cmd.Parameters.Add(new SqlParameter("@Address", owner.Address));
                    cmd.Parameters.Add(new SqlParameter("@NeighborhoodId", owner.NeighborhoodId));

                    int id = (int)cmd.ExecuteScalar();

                    owner.Id = id;
                }
            }
        }
コード例 #19
0
ファイル: BlockSkill.cs プロジェクト: dmsrlsla/KnightMare
 public override void InitSkill()
 {
     casterActor = OWNER.GetData(ConstValue.ActorData_GetThisActor) as Actor;
 }
コード例 #20
0
        public OWNER GetOwnerById(int ownerId)

        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();

                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"
                        SELECT o.Id, o.[Name], o.NeighborhoodId, o.Phone, o.[Address], n.Id, n.[Name] AS NeighborhoodName
                        FROM [OWNER] o
                        LEFT JOIN Neighborhood n
                        ON o.NeighborhoodId = n.Id
                        WHERE o.Id = @id";

                    cmd.Parameters.Add(new SqlParameter("@id", ownerId));

                    SqlDataReader reader = cmd.ExecuteReader();


                    if (reader.Read())
                    {
                        int idColumn = reader.GetOrdinal("Id");
                        int idValue  = reader.GetInt32(idColumn);

                        int    NameColumn = reader.GetOrdinal("Name");
                        string NameValue  = reader.GetString(NameColumn);

                        int    PhoneColumn = reader.GetOrdinal("Phone");
                        string PhoneValue  = reader.GetString(PhoneColumn);

                        int    AddressColumn = reader.GetOrdinal("Address");
                        string AddressValue  = reader.GetString(AddressColumn);

                        int neighborhoodIdColumn = reader.GetOrdinal("NeighborhoodId");
                        int neighborhoodValue    = reader.GetInt32(neighborhoodIdColumn);

                        int    neighborhoodNameColumn = reader.GetOrdinal("NeighborhoodName");
                        string neighborhoodNameValue  = reader.GetString(neighborhoodNameColumn);

                        var owner = new OWNER()
                        {
                            Id             = idValue,
                            Name           = NameValue,
                            Phone          = PhoneValue,
                            Address        = AddressValue,
                            NeighborhoodId = neighborhoodValue,
                            Neighborhood   = new Neighborhood()
                            {
                                Id   = neighborhoodValue,
                                Name = neighborhoodNameValue
                            }
                        };


                        reader.Close();

                        return(owner);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: macgibbons/DogWalker
        static void Main(string[] args)
        {
            WalkerRepository       walkerRepo       = new WalkerRepository();
            NeighborhoodRepository neighborhoodRepo = new NeighborhoodRepository();
            OwnerRepository        ownerRepo        = new OwnerRepository();
            DogRepository          dogRepo          = new DogRepository();


            Console.WriteLine("Getting All Walkers:");
            Console.WriteLine();

            List <Walker> allWalkers = walkerRepo.GetAllWalkers();


            foreach (Walker walker in allWalkers)
            {
                Console.WriteLine($"{walker.Id}.) {walker.Name} Walks dogs in  {walker.Neighborhood.Name}.");
            }

            Console.WriteLine("--------------------");
            Console.WriteLine("Show Walkers in specific neighborhood");
            Console.WriteLine();

            List <Neighborhood> allNeighborhoods = neighborhoodRepo.GetAllNeighborhoods();

            foreach (var n in allNeighborhoods)
            {
                Console.WriteLine($"{n.Id} {n.Name}");
            }

            var    userInput    = int.Parse(Console.ReadLine());
            Walker singleWalker = walkerRepo.GetWalkerByNeighborhood(userInput);

            Console.WriteLine($"---- Dog walkers in {singleWalker.Neighborhood.Name} ----");
            Console.WriteLine($"{singleWalker.Id}.) {singleWalker.Name} ");

            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("---- Add a new Walker ----");
            Console.WriteLine();
            Console.WriteLine("What is their name?");
            var NewWalkerName = Console.ReadLine();

            Console.WriteLine($"What neighborhood does {NewWalkerName} work in?");
            foreach (var n in allNeighborhoods)
            {
                Console.WriteLine($"{n.Id} {n.Name}");
            }

            var    NewWalkerNeighborhoodId = int.Parse(Console.ReadLine());
            Walker NewWalker = new Walker
            {
                Name           = NewWalkerName,
                NeighborhoodId = NewWalkerNeighborhoodId
            };

            walkerRepo.AddWalker(NewWalker);

            Console.WriteLine($"{NewWalker.Name} has been added!");

            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("----Showing all Owners----");
            List <OWNER> allOwners = ownerRepo.GetAlOwners();
            List <Dog>   allDogs   = dogRepo.GetAllDogs();

            foreach (var o in allOwners)
            {
                Console.WriteLine("----------------");
                Console.WriteLine($"{o.Name} lives in {o.Neighborhood.Name}");
                Console.WriteLine($"{o.Address}");
                Console.WriteLine($"{o.Phone}");
                Console.WriteLine("---- Dogs ----");
                foreach (var d in allDogs)
                {
                    if (d.OwnerId == o.Id)
                    {
                        Console.WriteLine($"{d.Name}");
                    }
                }
                Console.WriteLine();
            }

            Console.WriteLine("---- Add a new Owner ----");
            Console.WriteLine();
            Console.WriteLine("What is their name?");
            var newOwnerName = Console.ReadLine();

            Console.WriteLine($"What is {newOwnerName}'s phone number?");
            var newOwnerPhone = Console.ReadLine();

            Console.WriteLine($"What is {newOwnerName}'s Address?");
            var newOwnerAddress = Console.ReadLine();

            Console.WriteLine($"What neighborhood does {newOwnerName} live in?");
            foreach (var n in allNeighborhoods)
            {
                Console.WriteLine($"{n.Id} {n.Name}");
            }

            var   NewOwnerNeighborhoodId = int.Parse(Console.ReadLine());
            OWNER NewOwner = new OWNER
            {
                Name           = newOwnerName,
                Phone          = newOwnerPhone,
                Address        = newOwnerAddress,
                NeighborhoodId = NewOwnerNeighborhoodId
            };

            ownerRepo.AddOwner(NewOwner);


            Console.WriteLine($"{NewOwner.Name} has been added!");

            Console.ReadLine();
            Console.Clear();
            WalksRepository walksRepo = new WalksRepository();

            Console.WriteLine("Chose a dog walker");
            foreach (var walker in allWalkers)
            {
                Console.WriteLine($"{walker.Id}.) {walker.Name}");
            }
            var walkerChoice = walkerRepo.GetWalkerById(int.Parse(Console.ReadLine()));

            Console.WriteLine($"{walkerChoice.Name} will walk all of who's dogs?");
            foreach (var owner in allOwners)
            {
                Console.WriteLine($"{owner.Id}.) {owner.Name}");
            }
            var ownerChoice = ownerRepo.GetOwnerById(int.Parse(Console.ReadLine()));

            Console.WriteLine("For how long?");
            var durationChoice = int.Parse(Console.ReadLine());

            walksRepo.addWalk(walkerChoice, DateTime.Now, ownerChoice, durationChoice);

            Console.WriteLine($"{walkerChoice.Name} just walked {ownerChoice.Name}'s dogs for {durationChoice} minutes on {DateTime.Now.ToString()} ");
        }
コード例 #22
0
        //Query the database for all the Walkers.
        public List <OWNER> GetAlOwners()
        {
            using (SqlConnection conn = Connection)
            {
                conn.Open();

                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = @"
                        SELECT o.Id, o.[Name], o.NeighborhoodId, o.Phone, o.[Address], n.Id, n.[Name] AS NeighborhoodName
                        FROM [OWNER] o
                        LEFT JOIN Neighborhood n
                        ON o.NeighborhoodId = n.Id";

                    SqlDataReader reader = cmd.ExecuteReader();

                    List <OWNER> allOwners = new List <OWNER>();


                    while (reader.Read())
                    {
                        int idColumn = reader.GetOrdinal("Id");
                        int idValue  = reader.GetInt32(idColumn);

                        int    NameColumn = reader.GetOrdinal("Name");
                        string NameValue  = reader.GetString(NameColumn);

                        int    PhoneColumn = reader.GetOrdinal("Phone");
                        string PhoneValue  = reader.GetString(PhoneColumn);

                        int    AddressColumn = reader.GetOrdinal("Address");
                        string AddressValue  = reader.GetString(AddressColumn);

                        int neighborhoodIdColumn = reader.GetOrdinal("NeighborhoodId");
                        int neighborhoodValue    = reader.GetInt32(neighborhoodIdColumn);

                        int    neighborhoodNameColumn = reader.GetOrdinal("NeighborhoodName");
                        string neighborhoodNameValue  = reader.GetString(neighborhoodNameColumn);

                        var owner = new OWNER()
                        {
                            Id             = idValue,
                            Name           = NameValue,
                            Phone          = PhoneValue,
                            Address        = AddressValue,
                            NeighborhoodId = neighborhoodValue,
                            Neighborhood   = new Neighborhood()
                            {
                                Id   = neighborhoodValue,
                                Name = neighborhoodNameValue
                            }
                        };

                        allOwners.Add(owner);
                    }

                    reader.Close();

                    return(allOwners);
                }
            }
        }