Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                db = new giedaEntities();
                var myPhase = new phase()
                {
                    name        = name.Text,
                    title       = title.Text,
                    description = description.Text,
                    created_at  = DateTime.Now,
                    updated_at  = DateTime.Now
                };
                db.phases.Add(myPhase);
                db.SaveChanges();

                MessageBox.Show("Record Added Successfully");


                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error !! " + ex.Message);
            }
        }
Esempio n. 2
0
    void BlockBuild(phase p)
    {
        switch (p)
        {
        case phase.phase1:
            StartCoroutine(blockbulider(0, 10, 2));
            break;

        case phase.phase2:
            StartCoroutine(blockbulider(10, 150, 3));
            break;

        case phase.phase3:
            StartCoroutine(blockbulider(150, 300, 3.5f));
            break;

        case phase.phase4:
            StartCoroutine(blockbulider(300, 500, 3.5f));
            break;

        case phase.phase5:
            StartCoroutine(blockbulider(500, 800, 4));
            break;

        case phase.phase6:
            StartCoroutine(blockbulider(800, 1000, 4));
            break;

        case phase.phase7:
            StartCoroutine(blockbulider(1000, 2000, 4));
            break;
        }
    }
Esempio n. 3
0
 public void letsBattle()
 {
     if (currentPhase == phase.player)
     {
         currentPhase = phase.battle;
     }
 }
        public IHttpActionResult Putphase(int id, phase phase)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != phase.ID)
            {
                return(BadRequest());
            }

            db.Entry(phase).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!phaseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        deck = new List <int>(GameObject.Find("Deck").GetComponent <deck>().decklist);
        shuffle(deck);
        addBossUniqueCard();
        bossdeck = new List <int>(GameObject.Find("Deck").GetComponent <deck>().bossDecklist);
        shuffle(bossdeck);

        handlist  = new List <int>();
        grave     = new List <int>();
        bossgrave = new List <int>();
        bossfield = new List <int>();
        field     = new List <int>();
        Carddata  = new carddata();
        LoadCardDataFromjson(GameObject.Find("Deck").GetComponent <whoandwhere>().number);
        Board = new board();

        handlimit           = 5;
        currentPhase        = phase.start;
        currentHand         = 0;
        currentBossField    = 0;
        currentField        = 0;
        enemyFieldLimit     = GameObject.Find("Deck").GetComponent <whoandwhere>().thefloor + 1;
        enemyField          = 0;
        how_many_boss_right = 0;
        how_many_my_right   = 0;
        CharactersName();
        attacker = -1;
    }
 // Update is called once per frame
 void Update()
 {
     if (state == phase.Active)
     {
         rdm = Random.Range(0, 3);
         ennemy[rdm].SetActive(false);
         Debug.Log(rdm);
         state = phase.Moving;
     }
     else if (state == phase.Moving)
     {
         for (int i = 0; i < ennemy.Count; i++)
         {
             ennemy[i].GetComponent <MovingEnnemyTeamVague>().Moving();
         }
     }
     else if (state == phase.Replace)
     {
         for (int j = 0; j < ennemy.Count; j++)
         {
             ennemy[j].transform.position = new Vector3(pos.position.x, ennemy[j].transform.position.y, ennemy[j].transform.position.z);
             ennemy[j].SetActive(true);
         }
         state = phase.Active;
     }
 }
Esempio n. 7
0
    public IEnumerator HeroAttackPhase()
    {
        turnPhase = phase.CombatPhase;                       //sets state of combat phase
        for (int i = 0; i < equippedCreaturesObj.Count; i++) //loop repeats for each creature fighting the hero
        {
            CreatureCard attackCreature = equippedCreaturesObj[i].GetComponent <CreatureCard>();
            StartCoroutine(animationController.AttackMove(equippedCreaturesObj[i], equippedHeroObj[0])); //starts coroutine for moving attacking card
            attackCreature.PlaySound();                                                                  //plays sound effect
            if (attackCreature.creatureData.dmg > currentArmour.armourData.hp)                           //checks if creature attack is strong enough to pierce armour
            {
                defHero.heroData.hp -= attackCreature.creatureData.dmg - currentArmour.armourData.hp;    //creature deals damage
            }
            HeroHPUpdate();                                                                              //updates UI text
            float combatDelay = 1.3f;

            yield return(new WaitForSeconds(combatDelay));

            //if (i!=equippedCreaturesObj.Count-1)
            //{
            //    yield return new WaitForSeconds(combatDelay);
            //}
            //else if (i == equippedCreaturesObj.Count - 1)
            //{
            //    yield return null;
            //}
        }

        if (defHero.heroData.hp <= 0) //checks if hero is dead
        {
            GameOver();
            CancelInvoke();
        }
        Invoke("EndTurn", endTurnDelay);
    }
Esempio n. 8
0
 private void SetChase()
 {
     ps = phase.chase;
     if (count < 4)
     {
         Invoke("SetScatter", chase_time);
     }
 }
Esempio n. 9
0
 public void letsPlayer()
 {
     if (currentPhase == phase.draw)
     {
         currentPhase = phase.player;
         StartCoroutine("enemyReady");
     }
 }
Esempio n. 10
0
 public void letsStart()
 {
     if (currentPhase == phase.end)
     {
         currentPhase = phase.start;
         recover();
     }
 }
Esempio n. 11
0
 public void letsDraw()
 {
     if (currentPhase == phase.start)
     {
         currentPhase = phase.draw;
         StartCoroutine("drawit");
     }
 }
Esempio n. 12
0
 public void letsEnd()
 {
     if (currentPhase == phase.battle)
     {
         enemyDone = false;
         StartCoroutine("EnemyAttackTime");
         currentPhase = phase.end;
     }
 }
Esempio n. 13
0
 private void SetScatter()
 {
     count++;
     if (count > 3)
     {
         scatter_time = 5;
     }
     Invoke("SetChase", scatter_time);
     ps = phase.scatter;
 }
Esempio n. 14
0
 IEnumerator EnemyAttackTime()
 {
     while (enemyDone == false)
     {
         enemyAttack();
         yield return(new WaitForSeconds(1f));
     }
     currentPhase = phase.start;
     recover();
 }
Esempio n. 15
0
        public IHttpActionResult Getphase(int id)
        {
            phase phase = db.phases.Find(id);

            if (phase == null)
            {
                return(NotFound());
            }

            return(Ok(phase));
        }
Esempio n. 16
0
 private void Start()
 {
     ps = phase.leave;
     Invoke("SetScatter", 1.5f);
     dot_threshold_one = dot_num / 3 * 2;
     dot_threshold_two = dot_num / 3;
     rd = red.GetComponent <SpriteRenderer>().sprite;
     or = orange.GetComponent <SpriteRenderer>().sprite;
     pi = pink.GetComponent <SpriteRenderer>().sprite;
     p  = purple.GetComponent <SpriteRenderer>().sprite;
 }
Esempio n. 17
0
 public GameData()
 {
     phaseOfGame = phase.waiting;
     players = new List<string>();
     playersAndColors = new List<PlayerList.Player>();
     playersAndCoords = new List<VisiblePlayers.Player>();
     //mapObjects = new List<List<VisibleObjects.MapObject>>();
     rand = new Random();
     timeOfEndingPhaseWaiting = DateTime.Now.AddSeconds(30);
     timeOfEndingPhaseGame = DateTime.Now.AddSeconds(50);
     timeOfEndingPhaseResult = DateTime.Now.AddSeconds(60);
 }
Esempio n. 18
0
        public IHttpActionResult Postphase(phase phase)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.phases.Add(phase);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = phase.ID }, phase));
        }
Esempio n. 19
0
 public GameData()
 {
     phaseOfGame      = phase.waiting;
     players          = new List <string>();
     playersAndColors = new List <PlayerList.Player>();
     playersAndCoords = new List <VisiblePlayers.Player>();
     //mapObjects = new List<List<VisibleObjects.MapObject>>();
     rand = new Random();
     timeOfEndingPhaseWaiting = DateTime.Now.AddSeconds(30);
     timeOfEndingPhaseGame    = DateTime.Now.AddSeconds(50);
     timeOfEndingPhaseResult  = DateTime.Now.AddSeconds(60);
 }
Esempio n. 20
0
    //calls the event for stopping the touch
    private void fingerReleased()
    {
        inputPhase = phase.idle;
        data.state = fingerState.up;

        //this is temporary and will not work on android
        data.lastX = Input.mousePosition.x;

        if (onFingerUp != null)
        {
            onFingerUp();
        }
    }
Esempio n. 21
0
    //calls the event for first touching the screen
    private void fingerTapped()
    {
        inputPhase = phase.started;
        data.state = fingerState.down;

        //this is temporary and will not work on android
        data.startX = Input.mousePosition.x;

        if (onFingerDown != null)
        {
            onFingerDown();
        }
    }
Esempio n. 22
0
        public IHttpActionResult Deletephase(int id)
        {
            phase phase = db.phases.Find(id);

            if (phase == null)
            {
                return(NotFound());
            }

            db.phases.Remove(phase);
            db.SaveChanges();

            return(Ok(phase));
        }
Esempio n. 23
0
 public GameData()
 {
     namesOfFileLabyrinths = new List <string>();
     namesOfFileLabyrinths.Add("labyrinth1.txt");
     players                  = new Dictionary <string, Player>();
     playersAndCoords         = new List <VisiblePlayers.Player>();
     mapObjects               = new List <VisibleObjects.MapObject>();
     rand                     = new Random();
     timeOfEndingPhaseWaiting = DateTime.Now.AddSeconds(40);
     timeOfEndingPhaseGame    = DateTime.Now.AddSeconds(50);
     timeOfEndingPhaseResult  = DateTime.Now.AddSeconds(60);
     ReadLabyrinth("labyrinth1.txt");
     phaseOfGame = phase.waiting;
 }
Esempio n. 24
0
        public IActionResult Post([FromBody] phase value)
        {
            var phase = new phase();

            phase.phaseId  = value.phaseId;
            phase.name     = value.name;
            phase.isActive = true;

            _context.phase.Add(phase);
            _context.SaveChanges();

            var send = _context.phase.Where(c => c.phaseId == phase.phaseId).FirstOrDefault <phase>();

            return(Ok(send));
        }
Esempio n. 25
0
 private void StopRun()
 {
     red.GetComponent <SpriteRenderer>().sprite    = rd;
     orange.GetComponent <SpriteRenderer>().sprite = or;
     pink.GetComponent <SpriteRenderer>().sprite   = pi;
     purple.GetComponent <SpriteRenderer>().sprite = p;
     ps = prev_phase;
     if (ps == phase.scatter)
     {
         Invoke("SetChase", scatter_time);
     }
     else
     {
         Invoke("SetScatter", chase_time);
     }
 }
Esempio n. 26
0
    public void ChangePhase()
    {
        switch (currentPhase)
        {
        case phase.empty:
            ImagesToHide.AddRange(
                new List <Image>()
            {
                normalMeat, burnedMeat
            }
                );
            ImagesToShow.Add(rawMeat);
            timer.Set(GameData.FRY_TIME, ChangePhase, counter);

            currentPhase = phase.raw;
            break;

        case phase.raw:
            ImagesToHide.AddRange(
                new List <Image>()
            {
                rawMeat, burnedMeat
            }
                );
            ImagesToShow.Add(normalMeat);
            timer.Set(GameData.BURN_TIME, ChangePhase, counter);
            counter.ChangeColor();

            currentPhase = phase.normal;
            break;

        case phase.normal:
            ImagesToHide.AddRange(
                new List <Image>()
            {
                rawMeat, normalMeat
            }
                );
            ImagesToShow.Add(burnedMeat);
            timer.Reset();

            currentPhase = phase.burned;
            break;
        }

        UpdateView();
    }
Esempio n. 27
0
        public IActionResult deactivate(int id, [FromBody] phase value)
        {
            var phase = _context.phase.Where(c => c.phaseId == id).FirstOrDefault <phase>();

            if (phase != null)
            {
                phase.isActive = false;

                _context.SaveChanges();

                return(Ok(phase));
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 28
0
    // Update is called once per frame
    new void Update()
    {
        base.Update();

        switch (currPhase)
        {
        case phase.exit:         // missile has just been launched and is delayed before targeting
            transform.position += transform.up * launchSpeed * Time.deltaTime;
            duration           -= Time.deltaTime * 1000;

            if (duration <= 0)
            {
                currPhase = phase.lockOn;
            }
            break;

        case phase.lockOn:         //find a target
            GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");

            if (enemies.Length == 0)
            {
                break;
            }

            lockTarget = enemies[Random.Range(0, enemies.Length)];
            if (lockTarget != null)
            {
                currPhase = phase.attacking;
            }
            break;

        case phase.attacking:         //rotate and move toward target
            if (lockTarget == null)
            {
                currPhase = phase.lockOn;
                break;
            }

            rotateToward(lockTarget);

            transform.position += transform.up * speed * Time.deltaTime;

            break;
        }
    }
Esempio n. 29
0
 //イベントから呼ばれた機能、numによってphaseが変わる
 public void healtISLess(int num)
 {
     if (num == 2)
     {
         currentState = State.Attackc;
         currentphase = phase.phase2;
     }
     else if (num == 3)
     {
         currentState = State.Attackd;
         currentphase = phase.phase3;
     }
     else if (num == 4)
     {
         currentphase = phase.end;
         anim.SetTrigger("dead");
     }
 }
Esempio n. 30
0
    public void RemoveMeat()
    {
        ImagesToHide.AddRange(
            new List <Image>()
        {
            rawMeat, normalMeat, burnedMeat
        }
            );
        UpdateView();

        timer.Reset();
        if (counter.currentColor != TimerView.color.green)
        {
            counter.ChangeColor();
        }

        currentPhase = phase.empty;
    }
Esempio n. 31
0
        public IActionResult Put(int id, [FromBody] phase value)
        {
            var phase = _context.phase.Where(c => c.phaseId == id).FirstOrDefault <phase>();

            if (phase != null)
            {
                phase.name = value.name;

                _context.SaveChanges();

                var send = _context.phase.Where(c => c.phaseId == phase.phaseId).FirstOrDefault <phase>();

                return(Ok(send));
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 32
0
        private void Charge(Game1 game, GameTime gameTime)
        {
            Game1.character.targetSpeed = 5.5f;
            GoTo(new Vector2((Game1.character.positionRectangle.X + (Game1.character.positionRectangle.Width / 2)) / Game1.map.tileWidth, (Game1.character.positionRectangle.Y + (Game1.character.positionRectangle.Height / 2)) / Game1.map.tileHeight), false, gameTime);
            if (position.Intersects(Game1.character.attackRectangle) && healthPct > 0)
            {
                damage = game.damageObject.dealDamage(10, 27);
                damageEffectList.Add(new DamageEffect(damage, game, new Vector2(Game1.character.positionRectangle.X, Game1.character.positionRectangle.Y), new Color(235, 10, 10, 255), "npc"));
                Game1.character.health -= damage;
                if (Game1.character.health <= 0)
                {
                    Respawn(game);
                }
                Game1.character.Hit();
                phaseTimer = 0;
                currentPhase = phase.beam;
            }

            if (!enraged)
            {
                if (phaseTimer >= 5)
                {
                    phaseTimer = 0;
                    currentPhase = phase.beam;
                }
            }
            else
            {
                if (phaseTimer >= 2.5f)
                {
                    phaseTimer = 0;
                    currentPhase = phase.beam;
                }
            }
        }
Esempio n. 33
0
 private void SwitchPhase()
 {
     if (currentPhase == phase.beam && phaseTimer != 0)
     {
         currentPhase = phase.mobs;
         phaseTimer = 0;
     }
     if (currentPhase == phase.mobs && phaseTimer != 0)
     {
         currentPhase = phase.charge;
         phaseTimer = 0;
     }
     if ((currentPhase == phase.sleep))
     {
         sleepTimer = SLEEPTIMER;
         currentPhase = phase.beam;
     }
 }
Esempio n. 34
0
 public void FinishGame()
 {
     phaseOfGame = phase.result;
 }
Esempio n. 35
0
 public void StartGame()
 {
     phaseOfGame = phase.game;
 }
Esempio n. 36
0
 private void SpawnMobs(Game1 game)
 {
     if (healthPct > 0 && mobs.Count < 50)
     {
         for (int i = 0; i < 5; i++)
         {
             mobs.Add(new Npc(position.X + i, position.Y - 48 + i, 30, 25, game.Content.Load<Texture2D>(@"Npc\bot"), game, map, 1, true, 25, 1, 5, 1, true));
         }
         for (int i = 0; i < mobs.Count; i++)
         {
             mobs[i].mob = true;
             mobs[i].bossMob = true;
             mobs[i].position.Width = 30;
             mobs[i].position.Height = 25;
             currentPhase = phase.charge;
         }
     }
 }