Ejemplo n.º 1
0
    protected override void InitializeActor()
    {
        base.InitializeActor();

        world = FindObjectOfType<WorldManager>();
        if(world ==  null) {
            Debug.Log("ERROR!     "+name+" couldn't find the WorldManager on initialization!");
        }

        // Store all anim info to be set in the animator at the end of the frame
        cachedAnimData = new CachedAnimData();
        cachedAnimData.transperency = 1.0f;

        movementComp = GetComponent<CharacterMover>();
        if(movementComp == null) {
            Debug.Log("WARNING!      "+name+" :: Doesn't have a movement component!");
        }

        animator = GetComponent<Animator>();
        if(animator == null) {
            Debug.Log("WARNING!      "+name+" :: Doesn't have an animator!");
        }
        animator.logWarnings = false;

        // Add the blood particle effect at init b/c its so frequently used. The others are added as needed
        if(bDoesConditionEffects && bloodEffectsPrototype != null) {
            bloodEffectSystem = AddEffectAttached(bloodEffectsPrototype, Vector3.zero);
        }

        health = baseHealth;
        cachedAnimData.mirroring = Facing.right;
        bIsDead = false;
        specialMove = SpecialMove.SM_None;

        if(!bCanModifyVisibilty) {
            visibility = MAX_VISIBILITY;
        }

        // Ability sets
        abilities = new List<Ability>();
        abilitiesInUse = new List<Ability>();
        pendingAbilities = new Queue<Ability>();

        // Create the effect heuristic: The effect classes apear in the same order as the effects enum
        activeEffects = new Effect[NUM_EFFECTS];
        activeEffects[(int)EffectType.Burning] = new Effect_HealthDrain(this, EffectType.Burning, 50, 0.3f);
        activeEffects[(int)EffectType.Bleeding] = new Effect_HealthDrain(this, EffectType.Bleeding, 10, 0.5f);
        activeEffects[(int)EffectType.Broken] = new Effect_Broken(this, EffectType.Broken);
        activeEffects[(int)EffectType.Knockdown] = new Effect_Knockdown(this, EffectType.Knockdown);
        activeEffects[(int)EffectType.Dazed] = new Effect_Daze(this, EffectType.Dazed);
        activeEffects[(int)EffectType.Poison] = new Effect_HealthDrain(this, EffectType.Poison, 25, 0.5f);
        activeEffects[(int)EffectType.Blind] = new Effect_Blind(this, EffectType.Blind);

        // One resistance stat for each effect type
        resistances = new float[NUM_EFFECTS];
        for(int i = 0; i < resistances.Length; i++) {
            resistances[i] = 0.0f;
        }

        // Stat Table: starts out 0'd
        //stats = new int[NUM_STATS];
        //for(int i = 0; i < stats.Length; i++) {
        //    stats[i] = 0;
        //}

        inventory = new Inventory(INVENTORY_SIZE);

        // Just set default attack location to be the torso
        attackTargetLocation = BodyPart.Torso;

        nearbyDrops = new List<DroppedItem>();

        // Search all children transforms for the shadow one
        if(transform.childCount > 0) {
            for(int i = 0; i < transform.childCount; i++) {
                if(transform.GetChild(i).GetComponent<SpriteRenderer>()) {
                    shadowTransform = transform.GetChild(i);
                    break;
                }
            }
        }
    }
Ejemplo n.º 2
0
    protected override void  InitializeActor()
    {
        base.InitializeActor();

        world = FindObjectOfType <WorldManager>();
        if (world == null)
        {
            Debug.Log("ERROR!     " + name + " couldn't find the WorldManager on initialization!");
        }

        // Store all anim info to be set in the animator at the end of the frame
        cachedAnimData = new CachedAnimData();
        cachedAnimData.transperency = 1.0f;

        movementComp = GetComponent <CharacterMover>();
        if (movementComp == null)
        {
            Debug.Log("WARNING!      " + name + " :: Doesn't have a movement component!");
        }

        animator = GetComponent <Animator>();
        if (animator == null)
        {
            Debug.Log("WARNING!      " + name + " :: Doesn't have an animator!");
        }
        animator.logWarnings = false;

        // Add the blood particle effect at init b/c its so frequently used. The others are added as needed
        if (bDoesConditionEffects && bloodEffectsPrototype != null)
        {
            bloodEffectSystem = AddEffectAttached(bloodEffectsPrototype, Vector3.zero);
        }

        health = baseHealth;
        cachedAnimData.mirroring = Facing.right;
        bIsDead     = false;
        specialMove = SpecialMove.SM_None;

        if (!bCanModifyVisibilty)
        {
            visibility = MAX_VISIBILITY;
        }

        // Ability sets
        abilities        = new List <Ability>();
        abilitiesInUse   = new List <Ability>();
        pendingAbilities = new Queue <Ability>();

        // Create the effect heuristic: The effect classes apear in the same order as the effects enum
        activeEffects = new Effect[NUM_EFFECTS];
        activeEffects[(int)EffectType.Burning]   = new Effect_HealthDrain(this, EffectType.Burning, 50, 0.3f);
        activeEffects[(int)EffectType.Bleeding]  = new Effect_HealthDrain(this, EffectType.Bleeding, 10, 0.5f);
        activeEffects[(int)EffectType.Broken]    = new Effect_Broken(this, EffectType.Broken);
        activeEffects[(int)EffectType.Knockdown] = new Effect_Knockdown(this, EffectType.Knockdown);
        activeEffects[(int)EffectType.Dazed]     = new Effect_Daze(this, EffectType.Dazed);
        activeEffects[(int)EffectType.Poison]    = new Effect_HealthDrain(this, EffectType.Poison, 25, 0.5f);
        activeEffects[(int)EffectType.Blind]     = new Effect_Blind(this, EffectType.Blind);

        // One resistance stat for each effect type
        resistances = new float[NUM_EFFECTS];
        for (int i = 0; i < resistances.Length; i++)
        {
            resistances[i] = 0.0f;
        }

        // Stat Table: starts out 0'd
        //stats = new int[NUM_STATS];
        //for(int i = 0; i < stats.Length; i++) {
        //    stats[i] = 0;
        //}

        inventory = new Inventory(INVENTORY_SIZE);

        // Just set default attack location to be the torso
        attackTargetLocation = BodyPart.Torso;

        nearbyDrops = new List <DroppedItem>();

        // Search all children transforms for the shadow one
        if (transform.childCount > 0)
        {
            for (int i = 0; i < transform.childCount; i++)
            {
                if (transform.GetChild(i).GetComponent <SpriteRenderer>())
                {
                    shadowTransform = transform.GetChild(i);
                    break;
                }
            }
        }
    }