Пример #1
0
 /// <summary>
 /// 複寫Damage傳入目標的Execute方法,狀態引發的傷害目標是初始化時就給予了,不能再執行Execute時給予
 /// </summary>
 public override void Execute(Chara _target)
 {
     //取得實際傷害量
     TrueDamage = GetDamage(_target);
     Debug.Log(string.Format("{0}受到{1}點{2}", Self.Name, TrueDamage, ExecuteComType));//ex:大惡魔受到砍殺狀態影響,造成56點傷害
     _target.ReceivePhysicalDamge(TrueDamage, false, HitTextType.DOT, ShowDelay);
 }
Пример #2
0
 public override void Execute(Chara _target)
 {
     base.Execute(_target);
     TrueCure = GetCure();//取得實際治癒量
     Debug.Log(string.Format("{0}對{1}恢復{2}點{3}", Self.Name, _target.Name, TrueCure, ExecuteComType));//ex:勇者施放治癒隊友造成46點恢復
     _target.ReceiveCure(TrueCure, true, HitTextType.Cure, ShowDelay);
 }
Пример #3
0
	void Start () {
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();
		sysChr = sys.GetComponent<Chara> ();
		numChara = sysPrp.party [partyNo];
		typeChara = numChara / 100;
		noChara = numChara % 100;
		scoreBuff = sysChr.scoreBuffs [typeChara] [noChara];
		for (int i = 0; i < numOfType; i++) {
			panelBuff [i] = sysChr.panelBuffs [typeChara] [noChara, i];
		}
		switch (typeChara) {
		case 0:
			spriteChara = sysChr.bluetypeSprites[noChara];
			break;
		case 1:
			spriteChara = sysChr.redtypeSprites[noChara];
			break;
		case 2:
			spriteChara = sysChr.yellowtypeSprites[noChara];
			break;
		}

		charaTexture = transform.gameObject.GetComponent<SpriteRenderer> ();
		charaTexture.sprite = spriteChara;
	}
Пример #4
0
 /// <summary>
 /// 顯示擊中文字,傳入[數字][擊中類型]
 /// </summary>
 public static void ShowHitText(Chara _cahra, int _value, HitTextType _type, float _showDelay)
 {
     if (!Isinit)
         return;
     if (HitTextList.Count == 0)
     {
         SpawnHitText().Show(_cahra, _value, _type, _showDelay);
     }
     else
     {
         bool isShowed = false;
         for (int i = 0; i < HitTextList.Count; i++)//用迴圈找可以播放的文字物件
         {
             if (!HitTextList[i].IsShowing)
             {
                 HitTextList[i].Show(_cahra, _value, _type, _showDelay);
                 isShowed = true;
                 break;
             }
         }
         if (!isShowed)//isShowed為false代表目前的文字物件都在播放,創造新的文字物件並播放
         {
             SpawnHitText().Show(_cahra, _value, _type, _showDelay);
         }
     }
 }
Пример #5
0
 /// <summary>
 /// 初始化施法狀態效果
 /// </summary>
 public Buffer(int _bufferID, Chara _self)
     : base(_bufferID, _self)
 {
     if (_bufferID == 0)
     {
         Debug.LogWarning("BufferID為0");
         return;
     }
     ExecuteComType = ExecuteType.Buffer;
     TheBufferType = GameDictionary.BufferDic[ID].Type;
     IsBuff = GameDictionary.BufferDic[ID].IsBuff;
     IsDeBuff = GameDictionary.BufferDic[ID].IsDeBuff;
     Probability = GameDictionary.BufferDic[ID].Probability;
     Duration = GameDictionary.BufferDic[ID].Duration;
     Circle = GameDictionary.BufferDic[ID].Circle;
     IniTrigger = GameDictionary.BufferDic[ID].IniTrigger;
     Stackable = GameDictionary.BufferDic[ID].Stackable;
     MaxStack = GameDictionary.BufferDic[ID].MaxStack;
     PAttack = GameDictionary.BufferDic[ID].PAttack;
     PLethalityRate = GameDictionary.BufferDic[ID].PLethalityRate;
     MAttack = GameDictionary.BufferDic[ID].MAttack;
     MLethalityRate = GameDictionary.BufferDic[ID].MLethalityRate;
     PDefense = GameDictionary.BufferDic[ID].PDefense;
     PResistenceRate = GameDictionary.BufferDic[ID].PResistanceRate;
     MDefense = GameDictionary.BufferDic[ID].MDefense;
     MResistenceRate = GameDictionary.BufferDic[ID].MResistanceRate;
     //初始化施法執行效果清單
     InitExecute();
 }
Пример #6
0
 /// <summary>
 /// 初始化施法治癒效果
 /// </summary>
 public Cure(int _cureID, Chara _self)
     : base(_cureID, _self)
 {
     ExecuteComType = ExecuteType.Cure;
     Probability = GameDictionary.CureDic[ID].Probability;
     BaseCure = GameDictionary.CureDic[ID].BaseCure;
     AbsoluteCure = GameDictionary.CureDic[ID].AbsoluteCure;
     ShowDelay = GameDictionary.CureDic[ID].ShowDelay;
 }
Пример #7
0
	//List<Chara> team1=new List<Chara>();

	//你是这么觉得的吗
	// Use this for initialization
	void Start () 
	{
		//chrs.Add(NetworkReachability );
		a=new Chara(105,20,1);
		a.def_rate_pen=0.4f;

		b=new Chara(105,20,5);	
		chrs.Add(a);
		chrs.Add(b);
	}
Пример #8
0
	// Use this for initialization
	void Start () {
		playedGachaFlag = true;
		sys = GameObject.Find ("Systems");
		sysPrp = sys.GetComponent<Systems> ();
		sysChr = sys.GetComponent<Chara> ();
		newCharaTexture = newCharaobj.GetComponent<SpriteRenderer> ();
		scoreBuffText = scoreBuffObj.GetComponent<Text> ();
		for (int i = 0; i < numOfType; i++) {
			panelBuffText[i] = panelBuffObj [i].GetComponent<Text> ();
		}
	}
Пример #9
0
 /// <summary>
 /// 初始化施法的傷害效果
 /// </summary>
 public Damage(int _damageID, Chara _self)
     : base(_damageID, _self)
 {
     ExecuteComType = ExecuteType.Damage;
     Probability = GameDictionary.DamageDic[ID].Probability;
     ShowDelay = GameDictionary.DamageDic[ID].ShowDelay;
     PAttack = GameDictionary.DamageDic[ID].PAttack;
     PLethalityRate = GameDictionary.DamageDic[ID].PLethalityRate;
     MAttack = GameDictionary.DamageDic[ID].MAttack;
     MLethalityRate = GameDictionary.DamageDic[ID].MLethalityRate;
     AbsoluteDamage = GameDictionary.DamageDic[ID].AbsoluteDamage;
 }
Пример #10
0
 /// <summary>
 /// 顯示傷害擊中文字,傳入[腳色][傷害數值][擊中類型][延遲顯示]
 /// </summary>
 public void Show(Chara _target, int _value, HitTextType _type, float _showDelay)
 {
     if (!IsInit)
         return;
     IsShowing = true;
     Type = _type;
     Target = _target;
     Value = _value;
     MyGameobject.SetActive(true);//先啟動gameobject不然不能執行Coroutine
     Go_Motion.SetActive(false);//先隱藏文字
     StartCoroutine(ShowCoroutine(_showDelay));
 }
Пример #11
0
        public Player(ContentManager content, GraphicsDeviceManager graphics, Chara dinoChosen, int index)
        {
            this.dinoChosen = dinoChosen;

            Image = content.Load<Texture2D>("Player/" + dinoChosen.ToString());

            _halfTextureSize = new Vector2(Image.Width / 2, Image.Height / 2);

            ControlScheme = ChosenControl.Gamepad;
            if (index == 1)
            {
                PlayerIndex = PlayerIndex.One;
            }
            else
            {
                PlayerIndex = PlayerIndex.Two;
            }

            Position = Vector2.Zero;
            Movement = Vector2.Zero;

            _laserPowerLevel = 1;// 4; change back to 4 for debug lasers
            Points = 0;
            if (dinoChosen == Chara.Bronto)
            {
                _maxHealth = 100;
                _maxCharge = 100;
            }
            else if (dinoChosen == Chara.Trex)
            {
                _maxHealth = 125;
                _maxCharge = 125;
            }
            else if (dinoChosen == Chara.Ptera)
            {
                _maxHealth = 75;
                _maxCharge = 150;
            }
            else if (dinoChosen == Chara.Cera)
            {
                _maxHealth = 150;
                _maxCharge = 75;
            }

            _currentHealth = _maxHealth;
            CurrentLazerCharge = _maxCharge;
        }
 /// <summary>
 /// 設定Buffer實體
 /// </summary>
 public void IniBuffer(Buffer _buffer, Chara _self)
 {
     gameObject.name = string.Format("PBufferID({0})", _buffer.ID);
     Self = _self;
     RelyBuffer = _buffer;
     //不執行重置剩餘時間,避免此狀態快觸發效果時因為又被賦予此狀態而又重置觸發效果時間
     //RemainTriggerTime = RelyBuffer.Circle;
     //判斷此狀態是否擁有觸發效果
     if (_buffer.Circle >= 0.1f && (_buffer.TriggerExecuteList != null && _buffer.TriggerExecuteList.Count != 0))
         IsTriggerBuffer = true;
     //如果可以擁有觸發效果
     if (IsTriggerBuffer)
     {
         //如果此狀態會初始觸發效果,則在初始化狀態後立刻執行觸發效果
         if (RelyBuffer.IniTrigger)
             Trigger();
     }
 }
Пример #13
0
	public void Atk(Chara chr)
	{
		int real_def=chr.def;
		real_def-=Mathf.CeilToInt( def_rate_pen*real_def);
		real_def-=this.def_pen;
	

		if(this.atk<=real_def)
		{
			float rate=(float)this.atk/(float)(real_def+1);
			if(Random.Range(0f,1f)>rate)
			{
				chr.hp-=1;
			}
		}
		else chr.hp-=this.atk-real_def;
		
		
	}
Пример #14
0
 void Start()
 {
     MyChara = transform.parent.GetComponent<Chara>();
 }
Пример #15
0
 //為狀態引發的傷害(BufferDamage)
 /// <summary>
 /// 初始化狀態的傷害觸發效果
 /// </summary>
 public BufferDamage(int _damageID, Chara _self)
     : base(_damageID, _self)
 {
 }
Пример #16
0
 public eAI_RecovMass(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #17
0
 public eAI_Overload1(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #18
0
 public override void RunEffect(Chara target)
 {
     effect      = (int)Mathf.Floor(Mathf.Pow(level + 1, 1.5f));
     target.atk -= effect;
 }
Пример #19
0
 // 不可在這裡設定目標,因為此腳色的技能目標會更動,如果在這裡設定目標,會發生狀態給出去後狀態的目標又改變
 //public Chara Target { get; protected set; }
 public ExecuteCom(int _executeID, Chara _self)
 {
     ID = _executeID;
     Self = _self;
 }
Пример #20
0
    public override Action GetAction(Chara source, List <Chara> allChara)
    {
        eAI_DebuffBindAll act = new eAI_DebuffBindAll(source, allChara);

        return(act);
    }
Пример #21
0
 public AttackFoe(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #22
0
    public void carryTask()
    {
        if (currentLine >= code.Length)
        {
            Done(); return;
        }
        string[] t   = code[currentLine].Split(':');
        string   cmd = t[0];

        if (t.Length <= 1)
        {
            currentLine++; carryTask(); return;
        }
        string[] p       = t[1].Split(',');
        bool     handler = false;

        currentLine++;

        Debug.Log("Drama script: (Command) '" + cmd + "' (Param) " + t[1]);
        // 人物路径任务
        // path:人物,task1,task2,...
        if (cmd == "path")
        {
            Chara chara = GameObject.Find(p[0]).GetComponent <Chara>();
            for (int i = 1; i < p.Length; i++)
            {
                float xB = 0, yB = 0;
                if (p[i].StartsWith("left"))
                {
                    xB = -float.Parse(p[i].Substring(4));
                }
                if (p[i].StartsWith("right"))
                {
                    xB = float.Parse(p[i].Substring(5));
                }
                if (p[i].StartsWith("up"))
                {
                    yB = float.Parse(p[i].Substring(2));
                }
                if (p[i].StartsWith("down"))
                {
                    yB = -float.Parse(p[i].Substring(4));
                }
                Debug.Log("Drama script: walk task enqueue:" + xB + "," + yB);
                chara.walkTasks.Enqueue(Chara.walkTask.fromStep(xB, yB));
            }
            chara.walkTaskCallback = carryTask;
            handler = true;
        }
        // 人物朝向改动
        // face:人物,dir
        if (cmd == "face")
        {
            Chara chara = GameObject.Find(p[0]).GetComponent <Chara>();
            if (p[1] == "left")
            {
                chara.dir = Chara.walkDir.Left;
            }
            if (p[1] == "right")
            {
                chara.dir = Chara.walkDir.Right;
            }
            if (p[1] == "up")
            {
                chara.dir = Chara.walkDir.Up;
            }
            if (p[1] == "down")
            {
                chara.dir = Chara.walkDir.Down;
            }
            chara.UploadWalk();
            handler = true;
            carryTask();
        }
        // meta
        if (cmd == "exit")
        {
            Application.Quit();
        }
        // 标签
        // label:标签
        // goto:标签
        if (cmd == "label")
        {
            handler = true;
            carryTask();
        }
        if (cmd == "goto")
        {
            for (int i = 0; i < code.Length; i++)
            {
                if (code[i] == "label:" + p[0])
                {
                    currentLine = i + 1;
                    break;
                }
            }
            handler = true;
            carryTask();
        }
        // 显示和隐藏
        // show:物体
        if (cmd == "show")
        {
            GameObject.Find(p[0]).SetActive(true);
            handler = true;
            carryTask();
        }
        // hide:物体
        if (cmd == "hide")
        {
            GameObject.Find(p[0]).SetActive(false);
            handler = true;
            carryTask();
        }
        // 调查任务
        // spy:调查内容
        if (cmd == "spy")
        {
            Dramas.LaunchCheck(p[0], carryTask);
            handler = true;
        }
        // 退出脚本(如果最后一项任务是需要等待的,则需要加入此行缓冲)
        if (cmd == "break")
        {
            currentLine = code.Length;
            handler     = true;
        }
        // 设置开关
        // set:开关名,global/personal,true/false
        if (cmd == "set")
        {
            string key = "";
            if (p[1] == "global")
            {
                key = p[0];
            }
            if (p[1] == "personal")
            {
                key = parent.gameObject.scene + "." + parent.gameObject.name + "." + p[0];
            }
            PlayerPrefs.SetString(key, p[2]);
            handler = true;
            carryTask();
        }
        // 选择
        // choice:标题,选项0,选项1,...
        if (cmd == "choice")
        {
            string        explain = p[0];
            List <string> choice  = new List <string>();
            for (int i = 1; i < p.Length; i++)
            {
                choice.Add(p[i]);
            }
            handler = true;
            MakeChoice.Create(carryTask, explain, choice.ToArray());
        }
        if (cmd == "distribute_choices")
        {
            int buff = 0;
            while (true)
            {
                if (code[currentLine].StartsWith("choice:"))
                {
                    buff++;
                }
                if (code[currentLine] == "endchoice:" && buff == 0)
                {
                    break;
                }
                if (code[currentLine] == "case:" + MakeChoice.choiceId.ToString() && buff == 0)
                {
                    break;
                }
                if (code[currentLine] == "endchoice:")
                {
                    buff--;
                }
                Debug.Log("require:" + "case:" + MakeChoice.choiceId.ToString() + ",buff:" + buff + "\n" + code[currentLine]);
                currentLine++;
            }
            currentLine++;
            handler = true;
            carryTask();
        }
        // case:选项编号
        if (cmd == "case")
        {
            int buff = 0;
            while (true)
            {
                if (code[currentLine].StartsWith("choice:"))
                {
                    buff++;
                }
                if (code[currentLine] == "endchoice:" && buff == 0)
                {
                    break;
                }
                if (code[currentLine] == "endchoice:")
                {
                    buff--;
                }
                currentLine++;
            }
            currentLine++;
            handler = true;
            carryTask();
        }
        if (cmd == "endchoice")
        {
            handler = true; carryTask();
        }
        // 触发器
        // if:开关名,global/personal,要求的true/false
        if (cmd == "if")
        {
            string key = "";
            if (p[1] == "global")
            {
                key = p[0];
            }
            if (p[1] == "personal")
            {
                key = parent.gameObject.scene + "." + parent.gameObject.name + "." + p[0];
            }
            string data = PlayerPrefs.GetString(key);
            if (p[2] != data)
            {
                int buff = 0;
                while (true)
                {
                    if (code[currentLine].StartsWith("if:"))
                    {
                        buff++;
                    }
                    if (code[currentLine] == "endif:" && buff == 0)
                    {
                        break;
                    }
                    if (code[currentLine] == "else:" && buff == 0)
                    {
                        break;
                    }
                    if (code[currentLine] == "endif:")
                    {
                        buff--;
                    }
                    currentLine++;
                }
                currentLine++;
            }
            handler = true;
            carryTask();
        }
        if (cmd == "else")
        {
            int buff = 0;
            while (true)
            {
                if (code[currentLine].StartsWith("if:"))
                {
                    buff++;
                }
                if (code[currentLine] == "endif:" && buff == 0)
                {
                    break;
                }
                if (code[currentLine] == "endif:")
                {
                    buff--;
                }
                currentLine++;
            }
            currentLine++;
            handler = true;
            carryTask();
        }
        if (cmd == "endif")
        {
            handler = true; carryTask();
        }
        // 更换背景音乐
        // bgm:背景音乐名
        if (cmd == "bgm")
        {
            MapCamera.bgm.clip = (AudioClip)Resources.Load("BGM\\" + p[0]);
            MapCamera.bgm.Play();
            handler = true;
            carryTask();
        }
        // 更换环境音效
        // bgs:环境音效名
        if (cmd == "bgs")
        {
            MapCamera.bgs.clip = (AudioClip)Resources.Load("BGM\\" + p[0]);
            MapCamera.bgs.Play();
            handler = true;
            carryTask();
        }
        // 停止BGM
        // stopbgm
        if (cmd == "stopbgm")
        {
            MapCamera.bgm.Stop();
            carryTask();
            handler = true;
        }
        // stopbgs
        if (cmd == "stopbgs")
        {
            MapCamera.bgs.Stop();
            carryTask();
            handler = true;
        }
        // 恢复BGM
        // rebgm
        if (cmd == "rebgm")
        {
            MapCamera.bgm.Play();
            carryTask();
            handler = true;
        }
        // rebgs
        if (cmd == "rebgs")
        {
            MapCamera.bgs.Play();
            carryTask();
            handler = true;
        }
        // 等待任务
        // wait:等待时间
        if (cmd == "wait")
        {
            GameObject fab    = (GameObject)Resources.Load("Prefabs\\WaitTicker"); // 载入母体
            GameObject ticker = GameObject.Instantiate(fab, new Vector3(0, 0, -1), Quaternion.identity);
            WaitTicker wait   = ticker.GetComponent <WaitTicker>();
            wait.waitTime = float.Parse(p[0]);
            wait.callback = carryTask;
            handler       = true;
        }
        // 音效任务
        // snd:音效名称,nowait/wait
        if (cmd == "snd")
        {
            GameObject  fab    = (GameObject)Resources.Load("Prefabs\\MusicPlayer"); // 载入母体
            GameObject  player = GameObject.Instantiate(fab, new Vector3(0, 0, -1), Quaternion.identity);
            AudioSource source = player.GetComponent <AudioSource>();
            source.clip = (AudioClip)Resources.Load("Snd\\" + p[0]);
            player.SetActive(true);
            source.Play();
            GameObject.Destroy(player, source.clip.length);
            handler = true;
            if (p[1] == "nowait")
            {
                carryTask();
            }
            if (p[1] == "wait")
            {
                player.GetComponent <DestoryCallback>().callback = carryTask;
            }
        }
        // 传送任务
        // tp:地图名称;传送点编号;朝向
        if (cmd == "tp")
        {
            MapCamera.initTp = int.Parse(p[1]);
            if (p[2] == "left")
            {
                MapCamera.initDir = Chara.walkDir.Left;
            }
            if (p[2] == "right")
            {
                MapCamera.initDir = Chara.walkDir.Right;
            }
            if (p[2] == "up")
            {
                MapCamera.initDir = Chara.walkDir.Up;
            }
            if (p[2] == "down")
            {
                MapCamera.initDir = Chara.walkDir.Down;
            }
            MapCamera.HitCheck = null;
            DramaScript nds = DramaCrossScene.Start(this);
            Switcher.Carry(p[0], UnityEngine.SceneManagement.LoadSceneMode.Single, 0, nds.carryTask);
            handler = true;
        }
        // 切换场景任务
        // sw:场景名称
        if (cmd == "sw")
        {
            MapCamera.HitCheck = null;
            DramaScript nds = DramaCrossScene.Start(this);
            Switcher.Carry(p[0], UnityEngine.SceneManagement.LoadSceneMode.Single, 0, nds.carryTask);
            if (MapCamera.bgm != null)
            {
                GameObject.Destroy(MapCamera.bgm); MapCamera.bgm = null;
            }
            if (MapCamera.bgs != null)
            {
                GameObject.Destroy(MapCamera.bgs); MapCamera.bgs = null;
            }
            handler = true;
        }
        // 情节任务
        // plot:情节预制体名称/clear
        if (cmd == "plot")
        {
            if (p[0] == "clear")
            {
                PlotCreator.Clear(carryTask);
            }
            else
            {
                Loading.Start(() => {
                    PlotCreator.LoadPlot(p[0]);
                    Loading.Finish();
                }, carryTask);
            }
            handler = true;
        }
        // 对话任务
        // say/immersion:人物,[是否禁止输入]
        // [(shake)/(rainbow)/...]对话内容
        if (cmd == "say" || cmd == "immersion")
        {
            // 创建剧本框架
            bool dinput = false;
            if (p.Length > 1)
            {
                if (p[1] == "true")
                {
                    dinput = true;
                }
                Debug.Log("DramaScript: say's third param detected:" + dinput);
            }
            Dramas drama = Dramas.LaunchScript(cmd == "say" ? "DialogFrameSrc" : "Immersion", carryTask);
            drama.Drama.Clear();
            string role = p[0];
            // 读取直至对话结束
            while (currentLine + 1 < code.Length)
            {
sayTag:
                t = code[currentLine].TrimStart().Split(':');
                Debug.Log("Drama script: (Dialog) " + code[currentLine]);
                // 初始化对话参数
                string            motion = "Enter";
                WordEffect.Effect effect = WordEffect.Effect.None;
                float             speed  = 0.03f;
                // 如果是对话
                if (t.Length == 1)
                {
                    // 格式化对话并提取附加参数
                    p = code[currentLine].TrimStart().Replace("(", ")").Split(')');
                    // 处理附加参数
                    for (int i = 1; i < p.Length; i += 2)
                    {
                        if (i == p.Length - 1)
                        {
                            break;
                        }
                        if (p[i] == "shake")
                        {
                            effect = WordEffect.Effect.Shake;
                        }
                        else if (p[i] == "rainbow")
                        {
                            effect = WordEffect.Effect.Rainbow;
                        }
                        else if (p[i] == "Leap" || p[i] == "Focus")
                        {
                            motion = p[i];
                        }
                        else
                        {
                            speed = float.Parse(p[i]);
                        }
                    }
                    // 装入结构体
                    Dramas.DramaData data = new Dramas.DramaData {
                        Character = role,
                        motion    = motion,
                        Effect    = effect,
                        content   = p[p.Length - 1],
                        Speed     = speed
                    };
                    // 添加对话
                    drama.Drama.Add(data);
                }
                else
                {
                    // 对话读取结束,跳出
                    if (t[0] == cmd)
                    {
                        role = t[1];
                        currentLine++;
                        goto sayTag;
                    }
                    break;
                }
                currentLine++;
            }
            // 刷新剧本
            drama.ReadDrama();
            drama.DisableInput = dinput;
            drama.gameObject.SetActive(true);
            lastDrama = drama;
            handler   = true;
            if (dinput)
            {
                carryTask();
            }
        }
        // 继续对话
        if (cmd == "resume")
        {
            lastDrama.Resume();
            handler = true;
        }
        // 未处理的脚本
        if (!handler)
        {
            Debug.LogWarning("'" + cmd + $"'(行 {currentLine - 1})未被处理。");
            carryTask(); return;
        }
        if (currentLine >= code.Length)
        {
            Done();
        }
    }
Пример #23
0
 /// <summary>
 /// 用於腳色施法執行狀態時,傳入目標,對目標賦予此狀態
 /// </summary>
 public override void Execute(Chara _target)
 {
     base.Execute(_target);
     Debug.Log(string.Format("{0}施放對{1}附加{2}效果", Self.Name, _target.Name, TheBufferType));//ex:勇者施放砍殺對大惡魔附加流血狀態
     _target.ReceiveBuffer(this);
 }
Пример #24
0
 /// <summary>
 /// 用於腳色施法執行狀態時,傳入目標,對目標賦予此狀態
 /// </summary>
 public override void Execute(Chara _target)
 {
     base.Execute(_target);
     Debug.Log(string.Format("{0}施放對{1}附加{2}效果", Self.Name, _target.Name, TheBufferType));//ex:勇者施放砍殺對大惡魔附加流血狀態
     _target.ReceiveBuffer(this);
 }
Пример #25
0
 void Start()
 {
     timetxt = GetComponent <Text>();
     chara   = GameObject.Find("Chara").GetComponent <Chara>();
 }
Пример #26
0
    public override Action GetAction(Chara source, List <Chara> allChara)
    {
        Action action = new eAI_HealE03(source, allChara);

        return(action);
    }
Пример #27
0
 public eAI_HealE03(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #28
0
 public eAI_BuffSelfDef(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #29
0
 public eAI_BuffShield1(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #30
0
 /// <summary>
 /// 初始化施法,傳入施法ID
 /// </summary>
 public Spell(int _spellID, Chara _self)
 {
     ID = _spellID;
     Self = _self;
 }
Пример #31
0
 public eAI_DefbreakAll(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #32
0
 /// <summary>
 /// 選択したキャラをgetCharaに保存する
 /// </summary>
 /// <param name="obj">選択したキャラ</param>
 public void GetChara(GameObject obj)
 {
     getChara = obj;
     chara    = getChara.GetComponent <Chara>();
     Debug.Log("Chara");
 }
Пример #33
0
 /// <summary>
 /// 複寫Cure傳入目標的Execute方法,狀態引發的治癒目標是初始化時就給予了,不能再執行Execute時給予
 /// </summary>
 public override void Execute(Chara _target)
 {
     TrueCure = GetCure();//取得實際治癒量
     Debug.Log(string.Format("{0}受到{1}點{2}", Self.Name, TrueCure, ExecuteComType));//ex:勇者受到祝福狀態影響,造成56點治癒
     _target.ReceiveCure(TrueCure, false, HitTextType.Cure, ShowDelay);
 }
Пример #34
0
    private void OnCollisionEnter2D(Collision2D col)
    {
        Chara other = col.collider.GetComponent <Chara>();

        if (alive && other != null)
        {
            if (chaser)
            {
                if (on_tag != null)
                {
                    on_tag(this, other);
                }

                // Explosion
                ParticleSystem ps = Instantiate(explosion_prefab);
                ps.startColor         = PlayerColor;
                ps.transform.position = col.contacts[0].point;
                camshake.Shake(CamShakeType.VeryStrong);

                // Hide and freeze
                rb.velocity    = Vector2.zero;
                rb.isKinematic = true;
                graphics.gameObject.SetActive(false);
                smoke_ps.Stop();
                alive = false;
            }
            else
            {
                // Correct position
                transform.position = (Vector2)other.transform.position
                                     + col.contacts[0].normal * radius * 2f;

                // Hide and freeze
                rb.velocity    = Vector2.zero;
                rb.isKinematic = true;
                graphics.gameObject.SetActive(false);
                smoke_ps.Stop();
                alive = false;
            }
        }
        else if (col.collider.CompareTag("Wall"))
        {
            // Wall collision

            float mag = col.relativeVelocity.magnitude;

            // Particles
            ParticleSystem ps = Instantiate(bump_particles_prefab);
            ps.transform.position = transform.position; // col.contacts[0].point;
            //ps.startColor = chaser ? PlayerColor :Color.white;

            // Squash
            if (squash_routine != null)
            {
                StopCoroutine(squash_routine);
            }
            squash_routine = StartCoroutine(Squash(col));

            // Cam shake
            float i = Mathf.Pow(Mathf.Min(mag / 30f, 1), 4);
            i *= i;
            camshake.Shake(Mathf.Lerp(0.05f, 0.1f, i), Mathf.Lerp(0, 0.5f, i), 1);

            // Event
            if (on_bump_wall != null)
            {
                on_bump_wall(mag / 30f);
            }
        }
    }
Пример #35
0
 //為狀態引發的治癒(BufferCure)
 public BufferCure(int _cureID, Chara _self)
     : base(_cureID, _self)
 {
 }
Пример #36
0
 /// <summary>
 /// 初始化施法,傳入施法ID
 /// </summary>
 public Spell(int _spellID, Chara _self)
 {
     ID   = _spellID;
     Self = _self;
 }
Пример #37
0
 public eAI_SevUPTarget(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #38
0
 /// <summary>
 /// 初始化施法,傳入施法ID
 /// </summary>
 public PassiveSpell(int _spellID, Chara _self)
     : base(_spellID, _self)
 {
     InitSpellData();
 }
Пример #39
0
 void Start()
 {
     characs = GameObject.Find("Chara").GetComponent <Chara>();
 }
Пример #40
0
 public override Action GetAction(Chara source, List <Chara> allChara)
 {
     return(new eAI_HealKill(source, allChara));
 }
Пример #41
0
 public eAI_AttackPunish(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #42
0
 /// <summary>
 /// 取得傷害
 /// </summary>
 protected virtual int GetDamage(Chara _target)
 {
     ///////////////////////////////物理傷害運算////////////////////////////////
     int pDamage = 0;
     //物理殺傷力= (腳色物攻值+裝備物攻值+效果物攻值+技能物攻值) *(效果物傷乘值) * (技能物傷乘值)
     int pLethality = (int)((Self.PAttack + Self.EquipPAttack + Self.BufferPAttack + PAttack) * (Self.BufferPLethalityRate) * (PLethalityRate) * (Self.EquipPLethalityRate));
     //物抗力=(腳色防禦值+裝備防禦值+效果防禦加值) *(效果防禦乘值)*(裝備抵抗乘值)
     int pResistance = (int)((_target.PDefense + _target.EquipPDefense + _target.BufferPDefense) * _target.BufferPResistanceRate * _target.EquipPResistanceRate);
     //物理傷害值=(物理殺傷力*100)/(100+物抗力)
     pDamage = (int)((100 * pLethality) / (100 + pResistance));
     ///////////////////////////////魔法傷害運算////////////////////////////////
     int mDamage = 0;
     //////////////////////////////總傷害運算//////////////////////////////////
     //總傷害值=(物理傷害值+魔法傷害值)*(裝備傷害乘值)*(效果傷害乘值)+(絕對傷害值)
     int damage = (pDamage + mDamage) + (AbsoluteDamage);
     return damage;
 }
Пример #43
0
 public override Action GetAction(Chara source, List <Chara> allChara)
 {
     return(new eAI_AttackPunish(source, allChara));
 }
Пример #44
0
 /// <summary>
 /// 用於腳色施法執行傷害效果時,傳入目標,對目標造成傷害
 /// </summary>
 public override void Execute(Chara _target)
 {
     base.Execute(_target);
     //取得實際傷害量
     TrueDamage = GetDamage(_target);
     Debug.Log(string.Format("{0}對{1}造成{2}點{3}", Self.Name, _target.Name, TrueDamage, ExecuteComType));//ex:勇者施放砍殺大惡魔造成46點傷害
     _target.ReceivePhysicalDamge(TrueDamage, true, HitTextType.Hit, ShowDelay);
 }
Пример #45
0
 public eAI_BuffAtkAll(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #46
0
 public override Action GetAction(Chara source, List <Chara> allChara)
 {
     return(new eAI_Attack4div2Target(source, allChara));
 }
Пример #47
0
 public void setTarget(Chara target)
 {
     this.target = target;
 }
Пример #48
0
 public eAI_Attack4div2Target(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #49
0
 public eAI_AttackBloodLust(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }
Пример #50
0
 /// <summary>
 /// 執行
 /// </summary>
 public virtual void Execute(Chara _target)
 {
 }
Пример #51
0
    private IEnumerator UpdateAI()
    {
        GameManager gm          = GameManager.Instance;
        Chara       opponent    = gm.charas[1 - PlayerID];
        Vector2     move_target = transform.position;

        float change_target_time = 0;

        while (true)
        {
            while (Time.timeScale == 0)
            {
                yield return(null);
            }

            Vector2 pos       = transform.position;
            Vector2 opos      = opponent.transform.position;
            Vector2 opos_pred = opos + opponent.rb.velocity * 0.5f;


            // Chaser
            if (IsChaser())
            {
                if (waypoints.HasLOS(pos, opos))
                {
                    move_target = opos_pred;
                }
                else if (Time.time - change_target_time > 0.1f)
                {
                    move_target        = waypoints.FindPathNextWP(pos, opos_pred);
                    change_target_time = Time.time;
                }
            }
            // Runner
            else
            {
                if (Time.time - change_target_time > 0.1f)
                {
                    // Choose waypoint furthest from opp with direct path as move target
                    float dist_to_opp = 0;
                    foreach (Vector2 wp in waypoints.Points)
                    {
                        if (!waypoints.HasLOS(pos, wp))
                        {
                            continue;
                        }
                        Vector2 wp_dir  = (wp - pos).normalized;
                        Vector2 opp_dir = (opos_pred - pos).normalized;
                        if (Vector2.Angle(wp_dir, opp_dir) < 45f)
                        {
                            continue;
                        }

                        float dist = Vector2.Distance(wp, opos_pred);
                        if (dist > dist_to_opp)
                        {
                            move_target = wp;
                            dist_to_opp = dist;
                        }
                    }
                    change_target_time = Time.time;
                }
            }

            // Set move dir
            des_move_dir = (move_target - pos).normalized;
            Debug.DrawLine(pos, move_target, Color.red);

            // Power
            if (power != Power.None)
            {
                if (UnityEngine.Random.value < 0.01f)
                {
                    UsePower();
                }
            }

            yield return(null);
        }
    }
Пример #52
0
 private void OnTag(Chara tagger, Chara target)
 {
     StopAllCoroutines();
     StartCoroutine(PlaySnippet());
 }
Пример #53
0
 public eAI_DebuffBindAll(Chara source, List <Chara> targetList)
 {
     this.source     = source;
     this.targetList = targetList;
 }