private void Start() { GetComponent <Animator>().SetTrigger("Skill2"); SkillInfo skill = GetComponent <SkillsInfo>().GetSkillByID(2); m_SkillMachine = SkillLogic.CreateSkillMechine(skill, transform.position + new Vector3(0, 0.5f, 0.5f), this.gameObject); evt = new MyEvent(MyEvent.MyEventType.SkillTrigger); //DateTime d = DateTime.Now; //DateTime dt = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); //TimeSpan nowtime = d - dt; //string nowTimeStamp = Convert.ToInt64(nowtime.TotalSeconds).ToString(); //long time = long.Parse(nowTimeStamp); //TimeSpan ts = new TimeSpan(time); //Debug.Log(dt.AddSeconds(time)); //int year = DateTime.Now.Year; //int month = DateTime.Now.Month; //DateTime d1 = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 4, 1); //Debug.Log(d1.AddHours(23).AddMinutes(60));//当月第一天 //Debug.Log(d1.AddMonths(1).AddDays(-1));//当月最后一天 //SetTimeTable(); }
public override void DoBeforeEntering() { base.DoBeforeEntering(); Debug.Log("Enter SKillState"); sm = attr.GetComponent <SkillManager>(); m_animator.SetBool("Attack", true); m_activeSkill = attr.GetComponent <SkillsInfo>().GetActiveSkill(); //启动技能状态机 m_sm = SkillLogic.CreateSkillMechine(m_activeSkill, attr.transform.position, attr.gameObject); }
/// <summary> /// 创建技能状态机 /// </summary> /// <param name="activeSkill">技能机对应技能</param> /// <param name="pos">技能机初始位置</param> /// <param name="attacker">技能施放者</param> /// <param name="enemy">敌人信息 默认为null(非指定性技能)</param> public static SkillMachine CreateSkillMechine(SkillInfo activeSkill, Vector3 pos, GameObject attacker, GameObject enemy = null) { GameObject go = new GameObject("SkillMachine" + activeSkill.M_Name); SkillMachine sm = go.AddComponent <SkillMachine>(); sm.m_SkillInfo = activeSkill; sm.m_SkillDataConfiger = GetSkillInfo(activeSkill); sm.m_InitPos = pos; sm.m_Attacker = attacker; sm.m_Target = enemy; //go.transform.parent = GameManager.GM.gameObject.transform;//放到GameController组件物体下 go.transform.localPosition = Vector3.zero; return(sm); }