Beispiel #1
0
 public static void Clear()
 {
     for (E_Type type = E_Type.Idle; type < E_Type.Count; type += 1)
     {
         m_UnusedActions[(int)type].Clear();
     }
 }
Beispiel #2
0
 static AgentActionFactory()
 {
     for (E_Type i = 0; i < E_Type.E_COUNT; i++)
     {
         _UnusedActions[(int)i] = new Queue <AgentAction>();
     }
 }
Beispiel #3
0
 static AnimActionFactory()
 {
     for (E_Type type = E_Type.Idle; type < E_Type.Count; type += 1)
     {
         m_UnusedActions[(int)type] = new Queue <AnimAction>();
     }
 }
Beispiel #4
0
 public static void Clear()
 {
     for (E_Type i = 0; i < E_Type.Count; i++)
     {
         m_UnusedActions[(int)i].Clear();
     }
 }
    }//end RecieverCode

    //for answer check, grab if "E_State" != Right, sort of deal.
    public void ResetError()
    {///Debug.LogWarning("Resetting value now");

        //reset value of answer check
        state = E_State.Empty;
        if (heldObj != null) {//only apply if reciever/filled  && type == E_Type.Filled
                              //Debug.Log("null check works");
            
            //if in doubt, go nuclear and reload scene instead. Lazy wise

            


            NewRocketPuzzle heldRef = heldObj.GetComponent<NewRocketPuzzle>();
            heldRef.type = E_Type.Puzzle;//reset value of answer check

            if (resetPos != null) { }//jnc cautious check
            else Debug.LogWarning("variable error - resetPos is null");

            //reset heldObj to (mostly) initial settings
            heldObj.transform.position = resetPos;
            heldObj.tag = "Draggable";
            heldObj = null;
        }//endif
        type = E_Type.Reciever;
    }//end ResetError
Beispiel #6
0
 public void SetData(Vector3 localCoords, E_Type type, byte remainingHealth)
 {
     LocalCoordsX    = localCoords.x;
     LocalCoordsY    = localCoords.y;
     LocalCoordsZ    = localCoords.z;
     Type            = type;
     RemainingHealth = remainingHealth;
 }
Beispiel #7
0
 static ActionFactory()
 {
     //  初始化动作
     for (E_Type i = 0; i < E_Type.E_COUNT; i++)
     {
         m_UnusedActions[(int)i] = new Queue <ActionBase>();
     }
 }
Beispiel #8
0
 static AgentActionFactory()
 {
     for (E_Type i = 0; i < E_Type.E_COUNT; i++)
     {
         m_UnusedActions[(int)i] = new Queue <AgentAction>();
         //maybe we could precreate few of them ?
     }
 }
Beispiel #9
0
    // PUBLIC METHODS

    public void SpawnCube(E_Type type, byte hitPoints, Material material, bool activate)
    {
        Type                = type;
        CurrentHitPoints    = hitPoints;
        m_Renderer.material = material;
        Status              = activate ? E_Status.Active : E_Status.Disabled;
        m_GameObject.SetActiveSafe(activate);
    }
Beispiel #10
0
    public ActionSingle(E_Target target, E_Type type, float value, string[] param)
    {
        this.target = target;
        this.type = type;
        this.value = value;
        this.param = param;

        if (target == E_Target.Invalid || type == E_Type.Invalid)
        {
            Debug.LogError("args must be initilized: " + this);
        }
    }
    public int order;//enum tag comparison, to lazy int value

    //Awake is called first, when the script instance is being loaded
    private void Awake()
    {
        switch (gameObject.transform.childCount)
        {//Debug.Log("There are " + gameObject.transform.childCount + " Children in " + gameObject.name);
            case 0://size is zero, array wise
                type = E_Type.Puzzle;
                resetPos = transform.position;//jnc
                break;
            default://higher than 0 here
                type = E_Type.Reciever;
                resetPos = gameObject.transform.GetChild(0).transform.position;
                break;
        }//end switch. Does NOT take into account negative sized arrays
    }//end awake
Beispiel #12
0
    //캐릭터에 대한 초기화 및 배치를 함
    public virtual void Setup(CharacterStats _charic, CharacterManager _charicManager, SkillManager _skillManager, BattleManager _BattleManager, E_Type _E_TYPE, Vector3 _vecPosition, int _nBatchIndex = 0)
    {
        baseCharicStats = _charic;
        charicStats     = new CharacterStats(_charic);

        //스킬 매니저와 캐릭터 매니저를 등록
        skillManager     = _skillManager;
        characterManager = _charicManager;
        battleManager    = _BattleManager;

        //타입을 저장
        E_CHARIC_TYPE = _E_TYPE;

        //캐릭터 타입이 플레이어 캐릭일 경우
        if (E_CHARIC_TYPE == E_Type.E_Hero)
        {
            //패시브 스킬들을 적용
            ActivePassiveSkill();

            //처음 위치를 미리 저장해둔다.
            m_VecFirstPosition            = _vecPosition;
            gameObject.transform.position = m_VecFirstPosition;

            //캐릭터 UI들을 생성
            GameObject Charic_UI_Object = Instantiate(Resources.Load("Prefabs/Battle_Charic_Info") as GameObject);

            //생성된 캐릭터를 부모를 UI로 해줌
            Charic_UI_Object.transform.SetParent(battleManager.characterUI_Parent, false);

            //캐릭터 UI를 받아와서 세팅
            characterUI = Charic_UI_Object.GetComponent <CharacterUI> ();
            characterUI.SetUp(charicStats.m_fHealth);
        }
        else
        {
            gameObject.transform.position = _vecPosition;

            spriteRender.flipX = true;
        }

        //캐릭터의 현재 체력을 셋팅
        m_fCurrentHp = charicStats.m_fHealth;
        m_fMaxHp     = m_fCurrentHp;

        animator.runtimeAnimatorController = ObjectCashing.Instance.LoadAnimationController("Animation/Character/" + charicStats.m_strJob);

        CheckCharacterState(E_CHARACTER_STATE.E_WAIT);
    }
Beispiel #13
0
    public void Takedamage(int damage, E_Type unknownType)
    {
        if (unknownType == Type)
        {
            HP -= damage;
        }
        else
        {
            Debug.Log("Immune");
        }

        if (HP <= 0)
        {
            Die();
        }
    }
    }//end awake

    //OnTriggerEnter2D is called when 2D Collider ENTERS a trigger collider, collider wise.
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (type == E_Type.Reciever)
        {//draggable check
            if (collision.gameObject.tag == "Draggable")
            {//script reference check
                type = E_Type.Filled;
                NewRocketPuzzle refee = collision.gameObject.GetComponent<NewRocketPuzzle>();
                if (refee != null)//error check wise, hack though it may be
                {//puzzle script, function call wise.
                    collision.gameObject.transform.position = gameObject.transform.position;//IE: This position!
                    refee.RecieverCode(refee, collision.gameObject);//refee.heldObj = collision.gameObject;
                 ///type = E_Type.Filled;//fixes a "put two things in one" bug.
                }//endif
            }//endif
        }//endif        //else, no code is called, puzzle type wise ;)
    }//end OnTriggerEnter2D
Beispiel #15
0
    public static AnimAction Create(E_Type type)
    {
        AnimAction action;
        int        index = (int)type;

        if (m_UnusedActions[index].Count > 0)
        {
            action = m_UnusedActions[index].Dequeue();
        }
        else
        {
            switch (type)
            {
            case E_Type.Idle:
                action = new AnimActionIdle();
                break;

            case E_Type.PlayAnim:
                action = new AnimActionPlayAnim();
                break;

            case E_Type.Move:
                action = new AnimActionMove();
                break;

            case E_Type.UseSkill:
                action = new AnimActionUseSkill();
                break;

            case E_Type.Death:
                action = new AnimActionDeath();
                break;

            case E_Type.Hurt:
                action = new AnimActionHurt();
                break;

            default:
                Debug.LogError("no AgentAction to create");
                return(null);
            }
        }
        action.Reset();
        action.SetActive();
        return(action);
    }
	public int SearchTypeCount(E_Type _type)
	{
		int nCount = 0;

		foreach (Character charic in ARRAY_CHARIC) 
		{
			if (charic.IsDead () == true) 
				continue;

			if (charic.E_CHARIC_TYPE == _type) 
			{
				nCount++;	
			}
		}

		return nCount;
	}
Beispiel #17
0
    /// <summary>
    /// 使用E_Type创建AgentAction命令.
    /// </summary>
    /// <param name="_type">_type.</param>
    static public AgentAction Create(E_Type _type)
    {
        int         index = (int)_type;
        AgentAction a;

        if (_UnusedActions[index].Count > 0)
        {
            a = _UnusedActions[index].Dequeue();
        }
        else
        {
            switch (_type)
            {
            case E_Type.E_Idle:
                a = new AgentActionIdle();
                break;

            case E_Type.E_Move:
                a = new AgentActionMove();
                break;

            case E_Type.E_Weapon_Show:
                a = new AgentActionWeaponShow();
                break;

            case E_Type.E_Attack:
                a = new AgentActionAttack();
                break;

            case E_Type.E_Play_Anim:
                a = new AgentActionPlayAnim();
                break;

            default:
                Debug.LogError("No AgentAction Create!!! Type: " + _type.ToString());
                return(null);
            }
        }
        a.Reset();
        a.SetActive();
#if DEBUG
        _ActiveActions.Add(a);
#endif
        return(a);
    }
    public void CharacterDie(E_Type _type)
    {
        if (Battle_State == E_BATTLE_STATE.E_RESULT)
        {
            return;
        }

        if (_type == E_Type.E_Enemy)
        {
            m_bIsWin = true;
            BattleState_set(E_BATTLE_STATE.E_RESULT);
            return;

//			if (characterManager.SearchTypeCount(_type) == 0)
//			{
//				fPlusTimer = 0f;
//				nNowWaveIndex++;
//
//				if (nNowWaveIndex > nMaxWaveIndex)
//				{
//					m_bIsWin = true;
//					BattleState_set (E_BATTLE_STATE.E_RESULT);
//					return;
//				}
//
//				nCurMin = 0;
//				fCurSec =Wave_List[nNowWaveIndex].fWaveTime;
//
//				while (fCurSec > 60)
//				{
//					nCurMin++;
//					fCurSec -= 60.0f;
//				}
//			}
        }
        else if (_type == E_Type.E_Hero)
        {
            if (characterManager.SearchTypeCount(_type) == 0)
            {
                m_bIsWin = false;
                BattleState_set(E_BATTLE_STATE.E_RESULT);
            }
        }
    }
    static public AgentAction Create(E_Type _type)
    {
        int         index = (int)_type;
        AgentAction a     = null;

        if (_UnusedActions[index].Count > 0)
        {
            //Dequeue 表示移除
            a = _UnusedActions[index].Dequeue();
        }
        else
        {
            switch (_type)
            {
            case E_Type.E_Idle:
                a = new AgentActionIdle();
                break;

            case E_Type.E_Move:
                a = new AgentActionMove();
                break;

            //case E_Type.E_Attack:
            //    break;
            //case E_Type.E_Weapon_Show:
            //    break;
            //case E_Type.E_Play_Anim:
            //    break;
            //case E_Type.E_Count:
            //    break;
            default:
                Debug.Log("没有AgentAction被创建" + _type.ToString());
                break;
            }
        }

        a.Reset();
        a.SetActive();
#if DEBUG
        _ActiveActions.Add(a);
#endif
        return(a);
    }
Beispiel #20
0
    public override void Setup(CharacterStats _charic, CharacterManager _charicManager, SkillManager _skillManager, BattleManager _BattleManager, E_Type _E_TYPE, Vector3 _vecPosition, int _nBatchIndex = 0)
    {
        base.Setup(_charic, _charicManager, _skillManager, _BattleManager, _E_TYPE, _vecPosition);

        gameObject.transform.position = _vecPosition;

        CheckCharacterState(E_CHARACTER_STATE.E_WALK);

        spriteRender.flipX = true;
    }
Beispiel #21
0
    //  生成动作
    static public ActionBase Create(E_Type type)
    {
        int index = (int)type;

        ActionBase a;

        if (m_UnusedActions[index].Count > 0)
        {
            a = m_UnusedActions[index].Dequeue();
        }
        else
        {
            switch (type)
            {
            case E_Type.E_IDLE:
                a = new ActionIdle();
                break;

            case E_Type.E_MOVE:
                a = new ActionMove();
                break;

            case E_Type.E_GOTO:
                a = new ActionGoTo();
                break;

            case E_Type.E_COMBAT_MOVE:
                a = new ActionCombatMove();
                break;

            case E_Type.E_ATTACK:
                a = new ActionAttack();
                break;

            case E_Type.E_ATTACK_ROLL:
                a = new ActionAttackRoll();
                break;

            case E_Type.E_ATTACK_WHIRL:
                a = new ActionAttackWhirl();
                break;

            case E_Type.E_INJURY:
                a = new ActionInjury();
                break;

            case E_Type.E_DAMAGE_BLOCKED:
                a = new ActionDamageBlocked();
                break;

            case E_Type.E_BLOCK:
                a = new ActionBlock();
                break;

            case E_Type.E_ROLL:
                a = new ActionRoll();
                break;

            case E_Type.E_INCOMMING_ATTACK:
                a = new ActionIncommingAttack();
                break;

            case E_Type.E_WEAPON_SHOW:
                a = new ActionWeaponShow();
                break;

            case E_Type.E_Rotate:
                a = new ActionRotate();
                break;

            case E_Type.E_USE_LEVER:
                a = new ActionUseLever();
                break;

            case E_Type.E_PLAY_ANIM:
                a = new ActionPlayAnim();
                break;

            case E_Type.E_PLAY_IDLE_ANIM:
                a = new ActionPlayIdleAnim();
                break;

            case E_Type.E_DEATH:
                a = new ActionDeath();
                break;

            case E_Type.E_KNOCKDOWN:
                a = new ActionKnockdown();
                break;

            case E_Type.E_Teleport:
                a = new ActionTeleport();
                break;

            default:
                Debug.LogError("no Action to create");
                return(null);
            }
        }
        a.Reset();
        a.SetActive();

        m_ActionsInAction.Add(a);
        return(a);
    }
Beispiel #22
0
    public static AgentAction Create(E_Type type)
    {
        int index = (int)type;

        AgentAction a;

        if (m_UnusedActions[index].Count > 0)
        {
            a = m_UnusedActions[index].Dequeue();
        }
        else
        {
            switch (type)
            {
            case E_Type.Idle:
                a = new AgentActionIdle();
                break;

            case E_Type.Move:
                a = new AgentActionMove();
                break;

            case E_Type.Sprint:
                a = new AgentActionSprint();
                break;

            case E_Type.Goto:
                a = new AgentActionGoTo();
                break;

            case E_Type.Attack:
                a = new AgentActionAttack();
                break;

            case E_Type.Melee:
                a = new AgentActionMelee();
                break;

            case E_Type.Injury:
                a = new AgentActionInjury();
                break;

            case E_Type.Roll:
                a = new AgentActionRoll();
                break;

            case E_Type.WeaponChange:
                a = new AgentActionWeaponChange();
                break;

            case E_Type.Rotate:
                a = new AgentActionRotate();
                break;

            case E_Type.Use:
                a = new AgentActionUse();
                break;

            case E_Type.PlayAnim:
                a = new AgentActionPlayAnim();
                break;

            case E_Type.PlayIdleAnim:
                a = new AgentActionPlayIdleAnim();
                break;

            case E_Type.Death:
                a = new AgentActionDeath();
                break;

            case E_Type.Knockdown:
                a = new AgentActionKnockdown();
                break;

            case E_Type.Teleport:
                a = new AgentActionTeleport();
                break;

            case E_Type.CoverEnter:
                a = new AgentActionCoverEnter();
                break;

            case E_Type.CoverMove:
                a = new AgentActionCoverMove();
                break;

            case E_Type.CoverFire:
                a = new AgentActionCoverFire();
                break;

            case E_Type.CoverFireCancel:
                a = new AgentActionCoverFireCancel();
                break;

            case E_Type.CoverLeave:
                a = new AgentActionCoverLeave();
                break;

            case E_Type.Reload:
                a = new AgentActionReload();
                break;

            case E_Type.UseItem:
                a = new AgentActionUseItem();
                break;

            case E_Type.ConstructGadget:
                a = new AgentActionConstructGadget();
                break;

            case E_Type.TeamCommand:
                a = new AgentActionTeamCommand();
                break;

            default:
                Debug.LogError("no AgentAction to create");
                return(null);
            }
        }
        a.Reset();
        a.SetActive();

        // DEBUG !!!!!!
        //	m_ActionsInAction.Add(a);
        return(a);
    }
	//범위 스킬을 위함, _vecTargetPosition에 생성 되며 범위 안의 아군 캐릭터를 반환
	public ArrayList FindFriendDistanceArea(Vector3 _vecTargetPosition, float _fDistance, E_Type _skillerType)
	{
		ArrayList TargetArray = new ArrayList();
		ArrayList SortArray = new ArrayList(); //조건에 맞추어 정렬.

		foreach (Character kCharic in ARRAY_CHARIC)
		{
			if (kCharic.IsDead() == true) continue;
			if (kCharic.E_CHARIC_TYPE != _skillerType) continue; //아군이 아닐 경우

			float fDistance = Vector3.Distance(kCharic.gameObject.transform.position, _vecTargetPosition);

			if(fDistance < _fDistance)
				SortArray.Add(new SortunitClass() { m_value1 = fDistance, m_charic = kCharic });
		}

		ArraySort (SortArray, TargetArray);

		return TargetArray;
	}
Beispiel #24
0
    // CONSTRUCTOR

    public CubeFootprint(Vector3 localCoords, E_Type type, byte remainingHealth)
    {
        SetData(localCoords, type, remainingHealth);
    }
Beispiel #25
0
    /// <summary>
    /// 使用E_Type创建AgentAction命令.
    /// </summary>
    /// <param name="_type">_type.</param>
    static public AgentAction Create(E_Type _type)
    {
        int         index = (int)_type;
        AgentAction a;

        if (_UnusedActions[index].Count > 0)
        {
            a = _UnusedActions[index].Dequeue();
        }
        else
        {
            switch (_type)
            {
            case E_Type.E_IDLE:
                a = new AgentActionIdle();
                break;

            case E_Type.E_MOVE:
                a = new AgentActionMove();
                break;

            case E_Type.E_WEAPON_SHOW:
                a = new AgentActionWeaponShow();
                break;

            case E_Type.E_ATTACK:
                a = new AgentActionAttack();
                break;

            case E_Type.E_PLAY_ANIM:
                a = new AgentActionPlayAnim();
                break;

            case E_Type.E_GOTO:
                a = new AgentActionGoTo();
                break;
            //case E_Type.E_COMBAT_MOVE:
            //    a = new AgentActioCombatMove();
            //    break;
            //case E_Type.E_ATTACK_ROLL:
            //    a = new AgentActionAttackRoll();
            //    break;
            //case E_Type.E_ATTACK_WHIRL:
            //    a = new AgentActionAttackWhirl();
            //    break;
            //case E_Type.E_INJURY:
            //    a = new AgentActionInjury();
            //    break;
            //case E_Type.E_DAMAGE_BLOCKED:
            //    a = new AgentActionDamageBlocked();
            //    break;
            //case E_Type.E_BLOCK:
            //    a = new AgentActionBlock();
            //    break;
            //case E_Type.E_ROLL:
            //    a = new AgentActionRoll();
            //    break;
            //case E_Type.E_INCOMMING_ATTACK:
            //    a = new AgentActionIncommingAttack();
            //    break;

            //case E_Type.Rotate:
            //    a = new AgentActionRotate();
            //    break;
            //case E_Type.E_USE_LEVER:
            //    a = new AgentActionUseLever();
            //    break;


            //case E_Type.E_PLAY_IDLE_ANIM:
            //    a = new AgentActionPlayIdleAnim();
            //    break;
            //case E_Type.E_DEATH:
            //    a = new AgentActionDeath();
            //    break;
            //case E_Type.E_KNOCKDOWN:
            //    a = new AgentActionKnockdown();
            //    break;
            //case E_Type.Teleport:
            //    a = new AgentActionTeleport();
            //    break;
            default:
                Debug.LogError("No AgentAction Create!!! Type: " + _type.ToString());
                return(null);
            }
        }
        a.Reset();
        a.SetActive();
#if DEBUG
        _ActiveActions.Add(a);
#endif
        return(a);
    }
Beispiel #26
0
 public void SetType(E_Type _type)
 {
     m_type = _type;
 }
Beispiel #27
0
 public override void Setup(CharacterStats _charic, CharacterManager _charicManager, SkillManager _skillManager, BattleManager _BattleManager, E_Type _E_TYPE, Vector3 _vecPosition, int _nBatchIndex = 0)
 {
     base.Setup(_charic, _charicManager, _skillManager, _BattleManager, _E_TYPE, _vecPosition);
 }
 public override void Reset()
 {
     TypeOfLeave = E_Type.Back;
     Cover       = null;
 }
        //! serializes the entity to/from a PropertyStream
        public override void Serialize(PropertyStream stream)
        {
            base.Serialize(stream);

            m_FOV = stream.Serialize<float>("FOV");
            m_ZNear = stream.Serialize<float>("ZNear");
            m_ZFar = stream.Serialize<float>("ZFar");
            m_eType = (E_Type)stream.Serialize<int>("Projection");
            m_vUpVector = stream.Serialize<Vector3>("UpVector");
        }
Beispiel #30
0
    // PUBLIC METHODS

    public void SetData(E_Type type, object data = null)
    {
        m_Type = type;
        m_Data = data;

        string caption   = "";
        string text      = "";
        string hint      = TextDatabase.instance[m_DefaultHintTextId];
        bool   showGratz = false;

        switch (m_Type)
        {
        case E_Type.None:
            break;

        case E_Type.Item:
            if (m_Data != null)
            {
                var item = (UserGuideAction_Offers.ItemDesc)m_Data;
                caption   = TextDatabase.instance[item.Owned ? m_UpgradeItemCaptionId : m_GetItemCaptionId];
                text      = TextDatabase.instance[item.Item.GetName()];
                showGratz = true;

                ShowImage("Item_Image", item.Item.GetImage());
            }
            break;

        case E_Type.PremiumAcct:
        {
            bool owned = CloudUser.instance.isPremiumAccountActive;
            caption = TextDatabase.instance[owned ? m_UpgradePremiumAcctCaptionId : m_GetPremiumAcctCaptionId];
            text    = TextDatabase.instance[m_PremiumAcctTextId];

            ShowImage("Premium_Image");
        }
        break;

        case E_Type.MoreApps:
        {
            caption = TextDatabase.instance[m_MoreAppsCaptionId];
            text    = TextDatabase.instance[m_MoreAppsTextId];

            ShowImage("MoreApps_Image");
        }
        break;

        case E_Type.FreeGold:
        {
            caption = TextDatabase.instance[m_GetFreeGoldCaptiopnId];
            text    = TextDatabase.instance[m_FreeGoldTextId];
            hint    = TextDatabase.instance[m_FreeGoldHintTextId];

            ShowImage("FreeGold_Image");
        }
        break;

        case E_Type.Hat:
        {
            var item = (UserGuideAction_Offers.HatDesc)m_Data;
            caption   = TextDatabase.instance[m_GetHatCaptionId];
            text      = TextDatabase.instance[item.Item.Name];
            showGratz = true;

            ShowImage("Hat_Image", item.Item.ShopWidget);
        }
        break;

        case E_Type.Consumable:
        {
            var item = (UserGuideAction_Offers.ConsumableDesc)m_Data;
            caption   = TextDatabase.instance[m_GetConsumableCaptionId];
            text      = TextDatabase.instance[item.Item.Name];
            showGratz = true;

            ShowImage("Item_Image", item.Item.ShopWidget);
        }
        break;

        default:
            throw new System.IndexOutOfRangeException();
        }

        SetCaption(caption);
        SetText(text);
        SetHint(hint);
        ShowGratz(showGratz);
    }