Beispiel #1
0
 public void PlaySlidingAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("Spiderman_Sliding"), dir, 1f, null, null, null);
 }
Beispiel #2
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton   = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation  = new V_UnitAnimation(unitSkeleton);
        animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType("dMarine_Idle"), UnitAnimType.GetUnitAnimType("dMarine_Walk"), 1f, 1f);
    }
Beispiel #3
0
 public void PlayWebZipShootAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("Spiderman_ShootWebZip"), dir, 1f, null, null, null);
 }
Beispiel #4
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton   = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation  = new V_UnitAnimation(unitSkeleton);
        animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType(idleAnimation), UnitAnimType.GetUnitAnimType(walkAnimation), idleFrameRate, walkFrameRate);
        state          = State.Waiting;
        waitTimer      = waitTimeList[0];
        lastMoveDir    = defaultAimDirection;
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dMarine_Attack");
    }
 public void PlayDodgeAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dBareHands_Roll"), dir, 1.5f, null, null, null);
 }
        public static V_Object CreateSkeletonPresetAnim(Vector3 position, Material material, UnitAnimType unitAnimType, Vector3 dir, float frameRateMod)
        {
            V_Object instancedObject = CreateSkeleton(position, material);

            V_UnitSkeleton.OnAnimComplete onAnimComplete = delegate(UnitAnim unitAnim) {
                instancedObject.DestroySelf();
            };
            instancedObject.GetLogic <V_UnitAnimation>().PlayAnimForced(unitAnimType, dir, frameRateMod, onAnimComplete, null, null);
            return(instancedObject);
        }
        public static V_Object CreateSkeletonPresetAnim(Vector3 position, Material material, UnitAnimType unitAnimType, Vector3 dir, float frameRateMod, Vector3 rotatePrefabDir, Vector3 scalePrefab)
        {
            V_Object instancedObject = CreateSkeleton(position, material);

            V_UnitSkeleton.OnAnimComplete onAnimComplete = delegate(UnitAnim unitAnim) {
                instancedObject.DestroySelf();
            };
            instancedObject.GetLogic <V_UnitAnimation>().PlayAnimForced(unitAnimType, dir, frameRateMod, onAnimComplete, null, null);
            instancedObject.GetLogic <V_IObjectTransform>().SetEulerZ(GetAngleFromVector(rotatePrefabDir));
            instancedObject.GetLogic <V_IObjectTransform>().SetScale(scalePrefab);
            return(instancedObject);
        }
 public void SetAnimsSwordTwoHandedBack()
 {
     animatedWalker.SetAnimations(UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Idle"), UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Walk"), 1f, 1f);
     attackUnitAnim = UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Sword");
 }
 public void SetAnimsSwordShield()
 {
     animatedWalker.SetAnimations(UnitAnimType.GetUnitAnimType("dSwordShield_Idle"), UnitAnimType.GetUnitAnimType("dSwordShield_Walk"), 1f, 1f);
     attackUnitAnim = UnitAnimType.GetUnitAnimType("dSwordShield_Attack");
 }
Beispiel #10
0
 public void PlayDodgeAnimation(Vector3 dir)
 {
     unitAnimation.PlayAnimForced(UnitAnimType.GetUnitAnimType("dSwordShield_Roll"), dir, 1f, null, null, null);
 }
 public void SetAnimsBareHands()
 {
     animatedWalker.SetAnimations(UnitAnimType.GetUnitAnimType("dBareHands_Idle"), UnitAnimType.GetUnitAnimType("dBareHands_Walk"), 1f, 1f);
     attackUnitAnim = UnitAnimType.GetUnitAnimType("dBareHands_PunchQuickAttack");
 }
    public void Setup(Character.Type characterType, BattleHandler.LanePosition lanePosition, Vector3 startingPosition, bool isPlayerTeam, Character.Stats stats)
    {
        this.characterType    = characterType;
        this.lanePosition     = lanePosition;
        this.startingPosition = startingPosition;
        this.isPlayerTeam     = isPlayerTeam;
        this.stats            = stats;

        hitUnitAnimType    = GameAssets.UnitAnimTypeEnum.dBareHands_Hit;
        slideLeftUnitAnim  = UnitAnim.GetUnitAnim("dBareHands_SlideLeft");
        slideRightUnitAnim = UnitAnim.GetUnitAnim("dBareHands_SlideRight");

        Vector3 healthWorldBarLocalPosition = new Vector3(0, 10);

        switch (characterType)
        {
        case Character.Type.Player:
            material.mainTexture = GameAssets.i.t_Player;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Idle, GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Sword;

            if (GameData.GetCharacter(Character.Type.Player).hasFtnDewArmor)
            {
                Texture2D newSpritesheetTexture = new Texture2D(material.mainTexture.width, material.mainTexture.height, TextureFormat.ARGB32, true);
                newSpritesheetTexture.SetPixels((material.mainTexture as Texture2D).GetPixels());
                Color[] ftnDewArmorPixels = GameAssets.i.t_FtnDewArmor.GetPixels(0, 0, 512, 128);
                newSpritesheetTexture.SetPixels(0, 256, 512, 128, ftnDewArmorPixels);
                newSpritesheetTexture.Apply();
                material.mainTexture = newSpritesheetTexture;
            }

            if (GameData.GetCharacter(Character.Type.Player).hasSwordThousandTruths)
            {
                Texture2D newSpritesheetTexture = new Texture2D(material.mainTexture.width, material.mainTexture.height, TextureFormat.ARGB32, true);
                newSpritesheetTexture.SetPixels((material.mainTexture as Texture2D).GetPixels());
                Color[] swordThousandTruthsPixels = GameAssets.i.t_SwordThousandTruths.GetPixels(0, 0, 128, 128);
                newSpritesheetTexture.SetPixels(0, 128, 128, 128, swordThousandTruthsPixels);
                newSpritesheetTexture.Apply();
                material.mainTexture = newSpritesheetTexture;
            }
            break;

        case Character.Type.Tank:
            material.mainTexture = GameAssets.i.t_Tank;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dSwordShield_Idle, GameAssets.UnitAnimTypeEnum.dSwordShield_Walk, 1f, 1f);
            attackUnitAnimType   = GameAssets.UnitAnimTypeEnum.dSwordShield_Attack;
            transform.localScale = Vector3.one * 1.2f;
            break;

        case Character.Type.Healer:
            material.mainTexture = GameAssets.i.t_Healer;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dDualDagger_Idle, GameAssets.UnitAnimTypeEnum.dDualDagger_Walk, 1f, 1f);
            attackUnitAnimType   = GameAssets.UnitAnimTypeEnum.dDualDagger_Attack;
            transform.localScale = Vector3.one * 1.0f;
            break;

        case Character.Type.EvilMonster:
        case Character.Type.EvilMonster_2:
        case Character.Type.EvilMonster_3:
            material.mainTexture = GameAssets.i.t_EvilMonster;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dBareHands_Idle, GameAssets.UnitAnimTypeEnum.dBareHands_Walk, 1f, 1f);
            attackUnitAnimType            = GameAssets.UnitAnimTypeEnum.dBareHands_Punch;
            transform.localScale          = Vector3.one * 1.8f;
            healthWorldBarLocalPosition.y = 9.5f;
            break;

        case Character.Type.Enemy_MinionOrange:
            material.mainTexture = GameAssets.i.t_EnemyMinionOrange;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dMinion_Idle, GameAssets.UnitAnimTypeEnum.dMinion_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dMinion_Attack;
            break;

        case Character.Type.Enemy_MinionRed:
            material.mainTexture = GameAssets.i.t_EnemyMinionRed;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dMinion_Idle, GameAssets.UnitAnimTypeEnum.dMinion_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dMinion_Attack;
            break;

        case Character.Type.Enemy_Ogre:
            material.mainTexture = GameAssets.i.t_Ogre;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dOgre_Idle, GameAssets.UnitAnimTypeEnum.dOgre_Walk, 1f, 1f);
            attackUnitAnimType            = GameAssets.UnitAnimTypeEnum.dOgre_Attack;
            hitUnitAnimType               = UnitAnimType.GetUnitAnimType("dOgre_Hit");
            slideLeftUnitAnim             = UnitAnim.GetUnitAnim("dOgre_SlideLeft");
            slideRightUnitAnim            = UnitAnim.GetUnitAnim("dOgre_SlideRight");
            healthWorldBarLocalPosition.y = 12;
            break;

        case Character.Type.Enemy_Zombie:
            material.mainTexture = GameAssets.i.t_Zombie;
            playerBase.GetAnimatedWalker().SetAnimations(GameAssets.UnitAnimTypeEnum.dZombie_Idle, GameAssets.UnitAnimTypeEnum.dZombie_Walk, 1f, 1f);
            attackUnitAnimType = GameAssets.UnitAnimTypeEnum.dZombie_Attack;
            break;
        }
        transform.Find("Body").GetComponent <MeshRenderer>().material = material;

        healthSystem = new HealthSystem(stats.healthMax);
        healthSystem.SetHealthAmount(stats.health);
        healthWorldBar = new World_Bar(transform, healthWorldBarLocalPosition, new Vector3(12 * (stats.healthMax / 100f), 1.6f), Color.grey, Color.red, healthSystem.GetHealthPercent(), UnityEngine.Random.Range(1000, 2000), new World_Bar.Outline {
            color = Color.black, size = .6f
        });
        healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged;
        healthSystem.OnDead          += HealthSystem_OnDead;

        PlayIdleAnim();
    }
Beispiel #13
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton   = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation  = new V_UnitAnimation(unitSkeleton);
        animatedWalker = new AnimatedWalker(unitAnimation, UnitAnimType.GetUnitAnimType(idleAnimation), UnitAnimType.GetUnitAnimType(walkAnimation), idleFrameRate, walkFrameRate);
        state          = State.Waiting;
        waitTimer      = waitTimeList[0];
        lastMoveDir    = aimDirection;
        attackUnitAnim = UnitAnimType.GetUnitAnimType("dMarine_Attack");

        fieldOfView = Instantiate(pfFieldOfView, null).GetComponent <FieldOfView>();
        fieldOfView.SetFoV(fov);
        fieldOfView.SetViewDistance(viewDistance);
    }
 public V_UnitSkeleton_Composite_Walker(V_Object parentObject, V_UnitSkeleton unitSkeleton, UnitAnimType walkAnimType, UnitAnimType idleAnimType, string[] replaceBodyPartArray)
 {
     this.parentObject = parentObject;
     //this.objectWalker = objectWalker;
     this.unitSkeleton         = unitSkeleton;
     this.walkAnimType         = walkAnimType;
     this.idleAnimType         = idleAnimType;
     this.replaceBodyPartArray = replaceBodyPartArray;
 }
    public void Setup(Character character)
    {
        this.character     = character;
        transform.position = character.position;
        healthSystem       = new HealthSystem(character.stats.healthMax);
        healthSystem.SetHealthAmount(character.stats.health);
        healthWorldBar = new World_Bar(transform, new Vector3(0, 10), new Vector3(15, 2), Color.grey, Color.red, healthSystem.GetHealthPercent(), UnityEngine.Random.Range(10000, 11000), new World_Bar.Outline {
            color = Color.black, size = .6f
        });
        healthSystem.OnHealthChanged += HealthSystem_OnHealthChanged;
        RefreshHealthBar();

        RefreshTexture();

        playerBase.GetAnimatedWalker().SetAnimations(UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Idle"), UnitAnimType.GetUnitAnimType("dSwordTwoHandedBack_Walk"), 1f, .7f);

        OvermapHandler.GetInstance().OnOvermapStopped += NPCOvermap_OnOvermapStopped;
    }
Beispiel #16
0
 public void SetIdleWalkAnims(UnitAnimType idleUnitAnim, UnitAnimType walkUnitAnim)
 {
     animatedWalker = new AnimatedWalker(unitAnimation, idleUnitAnim, walkUnitAnim, 1f, 1f);
 }