コード例 #1
0
ファイル: background.cs プロジェクト: weirwood/maze-storm
	void Start () {
		for (int i =1; i< level; i++) {
			sco+=i*100;
		}

		bb = new GUIStyle();
		bb.normal.background = null;    //这是设置背景填充的
		bb.normal.textColor=new Color(1,0,0);   //设置字体颜色的
		bb.fontSize = 50;       //当然,这是字体颜色

		aa = new GUIStyle();
		aa.normal.background = null;    //这是设置背景填充的
		aa.normal.textColor=new Color(1,0,0);   //设置字体颜色的
		aa.fontSize = 30;       //当然,这是字体颜色


		level1.Initial ();
		InitBgSrc();//动态加载物体
		GameObject heroobj = GameObject.Find ("hero"); //调用脚本background中的地图
		heroscript = (hero)heroobj.GetComponent (typeof(hero));

		GameObject moneyobj = GameObject.Find ("enemy"); //调用脚本background中的地图
		moneyscript = (money)moneyobj.GetComponent (typeof(money));

		GameObject startspt = GameObject.Find ("startbtn"); //调用脚本background中的地图
		stspt = (startscript)startspt.GetComponent (typeof(startscript));
	}
コード例 #2
0
ファイル: CRUDController.cs プロジェクト: Nadeem133/myheroAPI
        public IHttpActionResult Puthero(int id, hero hero)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
ファイル: CRUDController.cs プロジェクト: Nadeem133/myheroAPI
        public IHttpActionResult Posthero(hero hero)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.heroes.Add(hero);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (heroExists(hero.ID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = hero.ID }, hero));
        }
コード例 #4
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 public void addSkillBuff(List<hero> heros,hero mainHero)
 {
     mainHero.skill = new List<skill> ();
     mainHero.buffNum = new buff ();
     mainHero.buffPer = new buff ();
     foreach (hero h in heros) {
         h.buffNum = new buff ();
         h.buffPer = new buff ();
         foreach(skill s in h.skill){
             if(s.target==0){
                 mainHero.skill.Add(s);
                 if(s.NumPer==0)
                     mainHero.buffNum.addBuff(1,s);
                 else
                     mainHero.buffPer.addBuff(1,s);
             }
             else if(s.target==1){
                 if(s.NumPer==0)
                     h.buffNum.addBuff(1,s);
                 else
                     h.buffPer.addBuff(1,s);
             }
         }
     }
 }
コード例 #5
0
ファイル: background.cs プロジェクト: weirwood/maze-storm
    void Start()
    {
        for (int i = 1; i < level; i++)
        {
            sco += i * 100;
        }

        bb = new GUIStyle();
        bb.normal.background = null;               //这是设置背景填充的
        bb.normal.textColor  = new Color(1, 0, 0); //设置字体颜色的
        bb.fontSize          = 50;                 //当然,这是字体颜色

        aa = new GUIStyle();
        aa.normal.background = null;               //这是设置背景填充的
        aa.normal.textColor  = new Color(1, 0, 0); //设置字体颜色的
        aa.fontSize          = 30;                 //当然,这是字体颜色


        level1.Initial();
        InitBgSrc();                                  //动态加载物体
        GameObject heroobj = GameObject.Find("hero"); //调用脚本background中的地图

        heroscript = (hero)heroobj.GetComponent(typeof(hero));

        GameObject moneyobj = GameObject.Find("enemy");          //调用脚本background中的地图

        moneyscript = (money)moneyobj.GetComponent(typeof(money));

        GameObject startspt = GameObject.Find("startbtn");          //调用脚本background中的地图

        stspt = (startscript)startspt.GetComponent(typeof(startscript));
    }
コード例 #6
0
ファイル: Player.cs プロジェクト: ylbs110/test
 void getMainData()
 {
     heroMainData = new hero();
     heroMainData.name = "playerMain";
     GM.getData (heroMainData,HeroData);
     GM.addSkillBuff(HeroData,heroMainData);
     heroMainData.thisData.clone (heroMainData.maxData);
 }
コード例 #7
0
ファイル: heroBaseUI.cs プロジェクト: ylbs110/test
 // Use this for initialization
 void Start()
 {
     GM=GameObject.FindGameObjectWithTag ("Player").GetComponent<gameManager> ();
     mainPlayer = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     thisHero = new hero ();
     thisToggleGroup = GameObject.FindGameObjectWithTag ("heroUIToggle").GetComponent<ToggleGroup>();
     thisToggle.group = thisToggleGroup;
     heroNumber = 0;
 }
コード例 #8
0
ファイル: elementFight.cs プロジェクト: ylbs110/test
 // Use this for initialization
 void Start()
 {
     speed = 0;
     heroNumber = 0;
     GM=GameObject.FindGameObjectWithTag ("Player").GetComponent<gameManager> ();
     mainPlayer = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     heroPicture=GetComponent<Image>();
     thisHero = new hero ();
 }
コード例 #9
0
ファイル: CRUDController.cs プロジェクト: Nadeem133/myheroAPI
        public IHttpActionResult Gethero(int id)
        {
            hero hero = db.heroes.Find(id);

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

            return(Ok(hero));
        }
コード例 #10
0
ファイル: elementFight.cs プロジェクト: ylbs110/test
 public void setCode(hero T)
 {
     //		code = T;
     //		thisHero = new hero ();
     //		foreach (hero go in GM.enemyData) {
     //			if(go.code==code){
     //				thisHero=go;
     //				return;
     //			}
     //		}
     thisHero = T;
 }
コード例 #11
0
 // Start is called before the first frame update
 void Start()
 {
     dinoWeaponScript = GameObject.Find("dinoWeapon").GetComponent <dinoWeapon>();
     princessScript   = GameObject.Find("_princess").GetComponent <hero>();
     anim             = GameObject.Find("dinoSprite").GetComponent <Animator>();
     bar                 = transform.Find("bar");
     barColor            = GameObject.Find("health");
     rend                = barColor.GetComponent <Renderer>();
     roarSound           = GameObject.Find("roar").GetComponent <AudioSource>();
     laserSound          = GameObject.Find("laser").GetComponent <AudioSource>();
     winSound            = GameObject.Find("winSound").GetComponent <AudioSource>();
     rend.material.color = Color.green;
 }
コード例 #12
0
    private hero test_hero;//测试
    void Start()
    {
        event_manager.Instance.add_event_listener(event_manager.EVT_LOGIC_FRAME_UPDATE, this.evt_logic_frame_update);
        GameObject hero = GameObject.Instantiate(this.hero_characters[ugames.Instance.usex]);

        hero.transform.SetParent(this.transform, false);
        hero.transform.position = this.entry_A.transform.position;
        hero ctrl = hero.AddComponent <hero>();

        ctrl.is_ghost = false;                    // 自己来控制;
        ctrl.logic_init(hero.transform.position); //逻辑数据部分的初始化
        this.test_hero = ctrl;
    }
コード例 #13
0
 void Awake()
 {
     rb = GetComponent <Rigidbody>();
     if (s == null)
     {
         s = this;
     }
     else
     {
         Debug.LogError("Hero.Awake()- Attempted to assign second hero.s");
     }
     //fireDelegate += TempFire;
 }
コード例 #14
0
ファイル: CRUDController.cs プロジェクト: Nadeem133/myheroAPI
        public IHttpActionResult Deletehero(int id)
        {
            hero hero = db.heroes.Find(id);

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

            db.heroes.Remove(hero);
            db.SaveChanges();

            return(Ok(hero));
        }
コード例 #15
0
 // Trigger limits collision
 void OnTriggerEnter2D(Collider2D other)
 {
     Flip();
     if (other.gameObject.name.Equals("hero"))
     {
         if (anim.GetCurrentAnimatorStateInfo(0).IsName("skeleton_atack"))
         {
             hero hero = other.gameObject.GetComponent <hero> ();
             if (hero != null)
             {
                 hero.ReceiveDamage();
             }
         }
     }
 }
コード例 #16
0
 //Vector3 laserPointPosition;
 // Vector3 beginPos;
 void Start()
 {
     pop = GameObject.Find("pop").GetComponent <AudioSource>();
     dinoWeaponScript = GameObject.Find("dinoWeapon").GetComponent <dinoWeapon>();
     healthScript     = GameObject.Find("HealthBar").GetComponent <healthBar>();
     healthScript.roaring();
     princesss      = GameObject.Find("_princess");
     laserPoint     = dinoWeaponScript.newPoint;
     princessScript = princesss.GetComponent <hero>();
     lr             = GetComponent <LineRenderer>();
     lr.SetPosition(0, transform.position);
     //birthtime = Time.time;
     Destroy(laserPoint, 4f);
     Destroy(gameObject, 4f);
     //beginPos = transform.position;
     //laserPointPosition = laserPoint.transform.position;
 }
コード例 #17
0
ファイル: Player.cs プロジェクト: ylbs110/test
 void getHeroData()
 {
     hero = GM.playerHero;
     good = GM.playerGood;
     HeroData = new List<hero> ();
     foreach (playerHero playerGo in hero)
         foreach (hero allGo in GM.allHero)
             if(playerGo.code==allGo.code){
                 hero go=new hero();
                 go.clone(allGo);
                 go.level=playerGo.level;
                 GM.changeAttributeLevel(go);
                 go.thisData.clone(go.maxData);
                 HeroData.Add(go);
                 continue;
             }
 }
コード例 #18
0
    private void on_sync_last_logic_frame(FrameOpts frame_opt)
    {
        //把所有英雄的输入进行处理
        //同步的时间间隔就是 逻辑帧的时间间隔
        for (int i = 0; i < frame_opt.opts.Count; i++)
        {
            int  seatid = frame_opt.opts[i].seatid;
            hero h      = this.get_hero(seatid);
            if (!h)
            {
                Debug.LogError("cannot find here: " + seatid);
                continue;
            }

            h.on_sync_last_logic_frame(frame_opt.opts[i]);
        }
    }
コード例 #19
0
    private hero place_hero_at(PlayerMatchInfo match_info, int index)
    {
        int        side     = match_info.side;
        user_info  uinfo    = ugame.Instance.get_user_info(match_info.seatid);
        GameObject h_object = GameObject.Instantiate(this.hero_characters[uinfo.usex]);

        h_object.name = uinfo.unick;
        h_object.transform.SetParent(this.transform, false);

        Vector3 center_pos;

        if (side == 0)
        {
            center_pos = this.map_entry_A.transform.position;
        }
        else
        {
            center_pos = this.map_entry_B.transform.position;
        }

        if (index == 0)
        {
            center_pos.z -= 3.0f;
        }
        else
        {
            center_pos.z += 3.0f;
        }

        h_object.transform.position = center_pos;

        hero ctrl = h_object.AddComponent <hero>();

        ctrl.is_ghost = (match_info.seatid != ugame.Instance.self_seatid);
        ctrl.logic_init(h_object.transform.position);
        ctrl.seatid = match_info.seatid;
        ctrl.side   = side;

        //创建要给ui血条
        UI_show_blood ui_blood = this.ui_blood_mgr.place_ui_blood_on_hero(side);

        ctrl.ui_blood = ui_blood;
        //end

        return(ctrl);
    }
コード例 #20
0
ファイル: fight.cs プロジェクト: ylbs110/test
	public static float attack(hero a,hero b){
		float thisDamage = -1;
		if (isHit(a.thisData.hi, b.thisData.av)) {
			float atPer=a.thisData.atpro-b.thisData.atpro;
			if(atPer<0)
				atPer=0;
			thisDamage=a.thisData.at*(1+atPer);
			if(isCr(a.thisData.cr))
				thisDamage*=(1+a.thisData.cpro);
			if(a.name=="playerMain"){
				thisDamage=thisDamage*(1+a.buffPer.clDem+a.buffPer.damage)+a.buffNum.clDem+a.buffNum.damage;
			}
			else{
				thisDamage=thisDamage*(1+a.buffPer.damage)+a.buffNum.damage;
			}
		}
		return thisDamage;
	}
コード例 #21
0
        static void Main(string[] args)
        {
            hero newHero = new hero();

            newHero.sName  = "맥스";
            newHero.nHP    = 10;
            newHero.nPower = 2;

            Console.WriteLine("이름 : {0}, 체력 : {1}, 공격력 : {2}", newHero.sName, newHero.nHP, newHero.nPower);
            newHero.Attack("허수아비");

            myclass mycat = new myclass(3, "Cat1");

            mycat.meow();

            myclass mycat2 = new myclass(5, "Cat2");

            mycat2.meow();
        }
コード例 #22
0
        public IActionResult Captain([FromServices] IConfiguration config)
        {
            hero personagem;

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(
                    new MediaTypeWithQualityHeaderValue("application/json"));

                string ts        = DateTime.Now.Ticks.ToString();
                string publicKey = config.GetSection("MarvelComicsAPI:PublicKey").Value;
                string hash      = GerarHash(ts, publicKey,
                                             config.GetSection("MarvelComicsAPI:PrivateKey").Value);

                HttpResponseMessage response = client.GetAsync(
                    config.GetSection("MarvelComicsAPI:BaseURL").Value +
                    $"characters?ts={ts}&apikey={publicKey}&hash={hash}&" +
                    $"name={Uri.EscapeUriString("Captain America")}").Result;

                try
                {
                    response.EnsureSuccessStatusCode();
                    string conteudo =
                        response.Content.ReadAsStringAsync().Result;

                    dynamic resultado = JsonConvert.DeserializeObject(conteudo);

                    personagem           = new hero();
                    personagem.Nome      = resultado.data.results[0].name;
                    personagem.Descricao = resultado.data.results[0].description;
                    personagem.UrlImagem = resultado.data.results[0].thumbnail.path + "." +
                                           resultado.data.results[0].thumbnail.extension;
                    personagem.UrlWiki = resultado.data.results[0].urls[1].url;
                    return(Ok(personagem));
                }catch {
                    return(Ok("erro"));
                }
            }

            //return Ok(personagem);
        }
コード例 #23
0
    private void on_handler_frame_event(FrameOpts frame_opt)
    {
        //调用英雄的logic_update
        this.on_frame_handle_hero_logic();
        //end

        //把所有玩家的操作带入进去
        for (int i = 0; i < frame_opt.opts.Count; i++)
        {
            int  seatid = frame_opt.opts[i].seatid;
            hero h      = this.get_hero(seatid);
            if (!h)
            {
                Debug.LogError("cannot find here: " + seatid);
                continue;
            }

            h.on_handler_frame_event(frame_opt.opts[i]);
        }
        //end

        //小兵位置
        this.on_frame_handle_monster_logic();
        //end

        //子弹逻辑先迭代
        this.on_frame_handle_tower_bullet_logic();
        //end

        // 塔的 AI 根据我们的处理,来进行处理...
        this.on_frame_handle_tower_logic();
        //end

        // 同步小兵的AI
        this.on_frame_handle_monster_ai();
        // end

        //产生怪物
        this.gen_moster();
        //end
    }
コード例 #24
0
    public override bool run_and_Pop(Dictionary <CardTxt, step_target> data)
    {
        hero he = createrMono.creater.aEmptycard <hero>();

        h2.player[0].TXT_move_card_to(he, cardWhere.space3d);
        h2.player[0].TXT_setHero(he);
        _0_camera.camera_.tarTest = he.transform;

        card1_tower t = createrMono.creater.aEmptycard <card1_tower>();

        h2.player[0].TXT_move_card_to(t, cardWhere.hand);

        t = createrMono.creater.aEmptycard <card1_tower>();
        h2.player[0].TXT_move_card_to(t, cardWhere.hand);


        weapon1 w = createrMono.creater.aEmptycard <weapon1>();

        h2.player[0].TXT_move_card_to(w, cardWhere.hand);

        return(true);
    }
コード例 #25
0
    void do_shoot()
    {
        List <hero> heros   = game_zygote.Instance.get_heros();
        hero        target  = null;
        float       min_len = this.config.attack_R + 1;

        for (int i = 0; i < heros.Count; i++)
        {
            hero h = heros[i];
            if (h.side == this.side)
            {
                continue;
            }

            Vector3 dir = h.transform.position - this.transform.position;
            float   len = dir.magnitude;
            if (len > this.config.attack_R)
            {
                continue;
            }

            // 在攻击范围之内,判断,是否是最近的
            if (len < min_len)
            {
                min_len = len;
                target  = h;
            }
        }

        if (target)
        {
            // 超这个目标发射发射一颗子弹
            // target 身上0.6高度的一个部位;  target角色控制器---> height * 0.6
            CharacterController ctrl = target.GetComponent <CharacterController>();
            Vector3             pos  = target.transform.position;
            pos.y += (ctrl.height * 0.6f);
            this.shoot_at(pos);
        }
    }
コード例 #26
0
    bool hit_test(Vector3 start_pos, float distance)
    {
        // 发射一条射线, start_pos 前方 ---> distance 的射线,看他撞倒的是哪些物体
        RaycastHit[] hits = Physics.RaycastAll(start_pos, this.transform.forward, distance);
        if (hits != null && hits.Length > 0)
        {
            for (int i = 0; i < hits.Length; i++)
            {
                RaycastHit hit = hits[i];
                if (hit.collider.gameObject.layer == (int)ObjectType.Hero)
                {
                    hero h = hit.collider.GetComponent <hero>();
                    if (h.side == this.side)
                    {
                        continue;
                    }

                    h.on_attacked(this.attack);
                }
            }
        }

        return(false);
    }
コード例 #27
0
ファイル: heroBaseUI.cs プロジェクト: ylbs110/test
 public void setCode(int T)
 {
     heroNumber = T;
     thisHero = mainPlayer.HeroData [heroNumber];
 }
コード例 #28
0
ファイル: Player.cs プロジェクト: ylbs110/test
 // Use this for initialization
 void Start()
 {
     GM=transform.GetComponent<gameManager>();
     HeroData = new List<hero> ();
     heroMainData = new hero ();
     heroUINumber =0;
     gold = 0;
     thisTime = 0;
 }
コード例 #29
0
 void Start()
 {
     karakter = transform.root.gameObject.GetComponent <hero>();
 }
コード例 #30
0
ファイル: playerHero.cs プロジェクト: ylbs110/test
 public hero clone(hero element)
 {
     this.code = element.code;
     this.name = element.name;
     this.level = element.level;
     this.maxData = element.maxData;
     this.thisData = element.thisData;
     this.skill = element.skill;
     this.buffNum = element.buffNum;
     this.buffPer = element.buffPer;
     return this;
 }
コード例 #31
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 //怪物数据
 void getEnemyData()
 {
     enemyData = new List<hero>();
     foreach (enemyHero EH in levelEnemyHero)
         foreach (hero ED in allHero) {
             if (EH.elementCode == ED.code) {
                 for(int i=0;i<EH.num;i++){
                 hero go=new hero();
                 go.clone(ED);
                 go.level=EH.level;
                 changeAttributeLevel(go);
                 go.maxData.hp+=EH.hp;
                 go.maxData.at+=EH.at;
                 go.thisData.clone(go.maxData);
                 enemyData.Add (go);
                 }
                 continue;
             }
         }
 }
コード例 #32
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 private void getAllHero()
 {
     for (int i=0; i<fightUnitDataJson.Count; i++){
         if(fightUnitDataJson [i] ["type"].ToString()=="0"){
             hero goData=new hero();
             goData.code=fightUnitDataJson [i] ["code"].ToString();
             goData.name=fightUnitDataJson [i] ["name"].ToString();
             goData.level=1;
             goData.maxData.hp=float.Parse(fightUnitDataJson [i]["hp"].ToString());
             goData.maxData.at=float.Parse(fightUnitDataJson [i]["at"].ToString());
             goData.maxData.ag=float.Parse(fightUnitDataJson [i]["ag"].ToString());
             goData.maxData.hi=float.Parse(fightUnitDataJson [i]["hi"].ToString());
             goData.maxData.av=float.Parse(fightUnitDataJson [i]["av"].ToString());
             goData.maxData.cr=float.Parse(fightUnitDataJson [i]["cr"].ToString());
             goData.maxData.cpro=float.Parse(fightUnitDataJson [i]["cpro"].ToString());
             goData.maxData.de=float.Parse(fightUnitDataJson [i]["de"].ToString());
             goData.maxData.depro=float.Parse(fightUnitDataJson [i]["depro"].ToString());
             goData.maxData.atpro=float.Parse(fightUnitDataJson [i]["atpro"].ToString());
             goData.thisData.clone(goData.maxData);
             for(int j=0;j<fightUnitDataJson [i] ["skill"].Count;j++)
             foreach(skill S in skillData)
                 if(fightUnitDataJson [i] ["skill"][j]["skill"].ToString()==S.code){
                     skill sk=new skill();
                     sk.clone(S);
                     goData.skill.Add(sk);
                 }
             allHero.Add(goData);
         }
     }
 }
コード例 #33
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 void Awake()
 {
     gold = 0;
     goldAdd = 0;
     gread = 0;
     nextGread = 0;
     thislevel="t1001";
     nextlevel="t1001";
     fightTime = 0;
     isFight = false;
     readAllJsonData ();
     findObject ();
     allHero = new List<hero> ();
     allGood = new List<good>();
     playerHero = new List<playerHero> ();
     playerGood = new List<playerGood> ();
     skillData = new List<skill> ();
     enemyHero = new List<enemyHero> ();
     normalPro = new List<prob> ();
     bestPro = new List<prob> ();
     levelEnemyHero=new List<enemyHero>();
     enemyData = new List<hero> ();
     openData = new List<levelOpenData> ();
     levelOpen = new List<string> ();
     levelOpenAll = new List<List<string>> ();
     levelOpenAll.Add (new List<string>());
     mainPlayer=transform.GetComponent<Player>();
     expData = new List<exp> ();
     enemyData=new List<hero>();
     enemyMainData=new hero();
     getAllkill ();
     getAllHero ();
     getAllGood ();
     getPlayerHero ();
     getPlayerGood ();
     getEnemyHero ();
     getEnemyData ();
     getAllPro ();
     getOpenData ();
     getExpData ();
 }
コード例 #34
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 public void getData(hero data,List<hero> listData)
 {
     foreach (hero ED in listData) {
         data.maxData.hp+=ED.maxData.hp;
         data.maxData.at+=ED.maxData.at;
         data.maxData.ag+=ED.maxData.ag;
         data.maxData.hi+=ED.maxData.hi;
         data.maxData.av+=ED.maxData.av;
         data.maxData.cr+=ED.maxData.cr;
         data.maxData.cpro+=ED.maxData.cpro;
         data.maxData.de+=ED.maxData.de;
         data.maxData.depro+=ED.maxData.depro;
         data.maxData.atpro+=ED.maxData.atpro;
     }
 }
コード例 #35
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 //属性处理
 public void changeAttributeLevel(hero data)
 {
     data.maxData.hp = data.maxData.hp * data.level;
     data.maxData.at = data.maxData.at * data.level;
     data.maxData.ag = data.maxData.ag;
     data.maxData.hi = data.maxData.hi;
     data.maxData.av = data.maxData.av;
     data.maxData.cr = data.maxData.cr;
     data.maxData.cpro = data.maxData.cpro;
     data.maxData.de = data.maxData.de;
     data.maxData.depro = data.maxData.depro;
     data.maxData.atpro = data.maxData.atpro;
 }
コード例 #36
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 public void attack(hero dataA,hero dataB)
 {
     float dropHp = fight.attack (dataA,dataB);
     if (dropHp == -1) {
         return;
     }
     dataB.thisData.hp -= dropHp;
 }
コード例 #37
0
ファイル: gameManager.cs プロジェクト: ylbs110/test
 void getMainData()
 {
     enemyMainData = new hero ();
     enemyMainData.code = "enemyMain";
     getData (enemyMainData,enemyData);
     addSkillBuff(enemyData,enemyMainData);
     enemyMainData.thisData.clone (enemyMainData.maxData);
 }
コード例 #38
0
    //Update is called once per frame
    void Update()
    {
        //behavours
        switch (behavour)
        {
        case 0: idle(); break;

        case 1: behavourNeutral(); break;

        case 2: behavourAttack(); break;

        case 3: behavourOnPlatform(); break;
            //case 4: be(); break;
        }



        if (health <= 0)
        {
            behavourDeath();
        }

        if (enemyAnimation.GetCurrentAnimatorStateInfo(0).IsName("death"))
        {
            float animationPercent = (enemyAnimation.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f);

            Debug.Log("death animation " + animationPercent);
            if (animationPercent > 0.9f)
            {
                Destroy(gameObject);
            }
        }
        else if (enemyAnimation.GetCurrentAnimatorStateInfo(0).IsName("attack"))
        {
            float animationPercent = (enemyAnimation.GetCurrentAnimatorStateInfo(0).normalizedTime % 1.0f);
            Debug.Log("attack animation ");

            if (animationPercent > 0.5f && animationPercent < 0.51f)
            {
                //hero.health = -10;
                GameObject go         = GameObject.Find("hero");
                hero       heroScript = (hero)go.GetComponent(typeof(hero));
                heroScript.health = health - 10;
            }
        }



        //movement
        if (movement > 0f)
        {
            transform.localRotation = Quaternion.Euler(0, 180, 0);
            rigidBody.velocity      = new Vector2(movement * speed, rigidBody.velocity.y);
        }
        else if (movement < 0f)
        {
            transform.localRotation = Quaternion.Euler(0, 0, 0);
            rigidBody.velocity      = new Vector2(movement * speed, rigidBody.velocity.y);
        }
        else
        {
            rigidBody.velocity = new Vector2(0, rigidBody.velocity.y);
        }

        //if (Input.GetButtonDown("Jump") && onGround)
        //{
        //    Debug.Log("hero jump");

        //    rigidBody.velocity = new Vector2(rigidBody.velocity.x, jumpSpeed);
        //}

        enemyAnimation.SetBool("heroClose", heroClose);
        enemyAnimation.SetFloat("speed", Mathf.Abs(rigidBody.velocity.x));

        enemyAnimation.SetFloat("health", health);

        //enemyAnimation.SetBool("onGround", onGround);
    }
コード例 #39
0
        private void Form1_Load(object sender, EventArgs e)
        {
            System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
            inputdata data = new inputdata();

            hero myhero = new hero(this);

            data      = new inputdata();//이거
            data.key  = Keys.Space;
            data.stat = 0;
            list.Add(data);

            data      = new inputdata();
            data.key  = Keys.Right;
            data.stat = 0;
            list.Add(data);

            data      = new inputdata();
            data.key  = Keys.Left;
            data.stat = 0;
            list.Add(data);

            data      = new inputdata();
            data.key  = Keys.Up;
            data.stat = 0;
            list.Add(data);

            data      = new inputdata();
            data.key  = Keys.Down;
            data.stat = 0;
            list.Add(data);

            data      = new inputdata();
            data.key  = Keys.Z;
            data.stat = 0;
            list.Add(data);

            data      = new inputdata();
            data.key  = Keys.Space;
            data.stat = 0;
            midlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Right;
            data.stat = 0;
            midlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Left;
            data.stat = 0;
            midlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Up;
            data.stat = 0;
            midlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Down;
            data.stat = 0;
            midlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Z;
            data.stat = 0;
            midlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Space;
            data.stat = 0;
            lastlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Right;
            data.stat = 0;
            lastlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Left;
            data.stat = 0;
            lastlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Up;
            data.stat = 0;
            lastlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Down;
            data.stat = 0;
            lastlist.Add(data);

            data      = new inputdata();
            data.key  = Keys.Z;
            data.stat = 0;
            lastlist.Add(data);

            timer1.Interval = 50;
            timer1.Start();
            timer1.Tick += new EventHandler(timer1_Tick);

            for (y = 0; y < 15; ++y)
            {
                for (x = 0; x < 15; ++x)
                {
                    if (map[y, x] == 1)
                    {
                        blocks[y, x]          = new PictureBox();//이거
                        blocks[y, x].SizeMode = PictureBoxSizeMode.StretchImage;
                        blocks[y, x].Location = new Point(y * 40, x * 40);
                        blocks[y, x].Width    = 40;
                        blocks[y, x].Height   = 40;
                        blocks[y, x].Image    = Properties.Resources.removeable;
                        blocks[y, x].Visible  = true;
                        this.Controls.Add(blocks[y, x]);
                    }
                    else if (map[y, x] == 2)
                    {
                        blocks[y, x]          = new PictureBox();
                        blocks[y, x].SizeMode = PictureBoxSizeMode.StretchImage;
                        blocks[y, x].Location = new Point(y * 40, x * 40);
                        blocks[y, x].Width    = 40;
                        blocks[y, x].Height   = 40;
                        blocks[y, x].Image    = Properties.Resources.seorap;
                        blocks[y, x].Visible  = true;
                        this.Controls.Add(blocks[y, x]);
                    }


                    Bubbles[y, x]          = new PictureBox();
                    Bubbles[y, x].SizeMode = PictureBoxSizeMode.StretchImage;
                    Bubbles[y, x].Location = new Point(y * 40, x * 40);
                    Bubbles[y, x].Width    = 40;
                    Bubbles[y, x].Height   = 40;
                    Bubbles[y, x].Image    = Properties.Resources.bubble;
                    Bubbles[y, x].Visible  = false;

                    floooor[y, x]          = new PictureBox();
                    floooor[y, x].SizeMode = PictureBoxSizeMode.StretchImage;
                    floooor[y, x].Location = new Point(y * 40, x * 40);
                    floooor[y, x].Width    = 40;
                    floooor[y, x].Height   = 40;
                    floooor[y, x].Image    = Properties.Resources.floor;
                    floooor[y, x].Visible  = true;

                    splash[y, x]          = new PictureBox();
                    splash[y, x].SizeMode = PictureBoxSizeMode.StretchImage;
                    splash[y, x].Location = new Point(y * 40, x * 40);
                    splash[y, x].Width    = 40;
                    splash[y, x].Height   = 40;
                    splash[y, x].Image    = Properties.Resources.water;
                    splash[y, x].Visible  = true;

                    this.Controls.Add(Bubbles[y, x]);
                    this.Controls.Add(floooor[y, x]);
                    this.Controls.Add(splash[y, x]);
                }
            }
        }
コード例 #40
0
ファイル: miniG.cs プロジェクト: sheng-guang/card
 //到卡组 /到手牌/到场上
 //接收任意卡牌到己方的任意位置
 public void TXT_setHero(hero h)
 {
     hero = h;
 }