Exemplo n.º 1
0
        public void ChangeState(IdolState s, Fsm fsm)
        {
            DebugUtils.Assert(fsm != null, "Can't translate to a null npc state!");

            currentFsm.OnExit();
            currentFsm = fsm;
            state      = s;

            DebugUtils.LogWarning(DebugUtils.Type.AI_Npc, string.Format("{0} {1} enter {2} state", npcType, id, state));
            currentFsm.OnEnter();
        }
Exemplo n.º 2
0
    void Start()
    {
        currentState = IdolState.WAITING;

        float stamPercent = (float)currentStamina / maxStamina;

        staminaMeter.transform.localScale = new Vector3(Mathf.Clamp(stamPercent, 0, 1), 1, 1);
        float spiritPercent = (float)currentSpirit / maxSpirit;

        spiritMeter.transform.localScale = new Vector3(Mathf.Clamp(spiritPercent, 0, 1), 1, 1);


        staminaText.text = currentStamina + " / " + maxStamina;
        spiritText.text  = currentSpirit + " / " + maxSpirit;

        head     = transform.Find("Head");
        body     = transform.Find("Body");
        armLeft  = transform.Find("Arm left");
        hand     = armLeft.Find("Hand");
        armRight = transform.Find("Arm right");


        headSprites = Resources.LoadAll <Sprite>(headFile);
        bodySprites = Resources.LoadAll <Sprite>(bodyFile);
        head.GetComponent <SpriteRenderer>().sprite = headSprites[2];
        body.GetComponent <SpriteRenderer>().sprite = bodySprites[1];
        hand.GetComponent <SpriteRenderer>().sprite = micSprite;

        skills = new Skill[5];

        Skill skill = new Skill(this, Skill.ActionType.SING, baseDrive, baseAlignment, profileImage);

        skills[0] = skill;

        skill     = new Skill(this, Skill.ActionType.DANCE, baseDrive, baseAlignment, profileImage);
        skills[1] = skill;

        skill     = new Skill(this, Skill.ActionType.CROWD_BOOST, baseDrive, baseAlignment, profileImage);
        skills[2] = skill;

        skill     = new Skill(this, Skill.ActionType.DANCE, Skill.Drive.KNOWLEDGE, baseAlignment, profileImage);
        skills[3] = skill;

        skill     = new Skill(this, Skill.ActionType.SING, Skill.Drive.FAME, baseAlignment, profileImage);
        skills[4] = skill;
    }
Exemplo n.º 3
0
        public void Initialize(long id, NpcData proto, FixVector3 p, FixVector3 r)
        {
            this.id = id;

            type = LogicUnitType.Idol;

            position           = p;
            transform.position = p.vector3;
            brithPosition      = p;
            brithDirection     = r;
            hurtType           = AttackPropertyType.PhysicalAttack;

            npcProto         = proto;
            metaId           = proto.ID;
            iconId           = -1;
            modelId          = proto.ModelID;
            modelRadius      = ConvertUtils.ToLogicInt(proto.ModelRadius);
            npcType          = (NpcType)proto.NPCType;
            attackType       = (NpcAttackType)proto.StandardAttack;
            rebornInterval   = ConvertUtils.ToLogicInt(proto.RebornInterval);
            physicasAttack   = (int)proto.PhysicsAttack;
            armor            = (int)proto.Armor;
            magicResist      = (int)proto.MagicResist;
            speedFactor      = proto.Speed;
            healthRegen      = proto.HealthRegen;
            maxHp            = proto.Health;
            chaseArea        = proto.TargetDetectRange;
            maxChaseDistance = proto.MaxChaseDistance;
            emberOutPut      = proto.EmberOutPut;
            projectileId     = proto.ProjectileId;
            attackRange      = proto.AttackRange;
            killReward       = proto.KillReward;
            fightInterval    = 1;

            hp     = maxHp;
            damage = physicasAttack;

            InitializeState();

            state      = IdolState.IDLE;
            currentFsm = fsmIdle;
            ChangeState(IdolState.IDLE, fsmIdle);
        }
Exemplo n.º 4
0
    void Update()
    {
        switch (currentState)
        {
        case IdolState.WAITING:

            break;

        case IdolState.ACTION:
            if (perform())
            {
                currentState = IdolState.WAITING;
            }

            break;

        case IdolState.FAINTED:

            break;
        }
    }
Exemplo n.º 5
0
 public void readyPerformance(Skill perform)
 {
     performing   = perform;
     currentState = IdolState.ACTION;
 }