예제 #1
0
 public static int GetHash(Anim anim)
 {
     if(anim == Anim.NUM_ANIMS) return -1;
     if (!_genHash)
     {
         GenerateHashIDs();
         _genHash = true;
     }
     return _ids[(int)anim];
 }
예제 #2
0
	public void setAnimation(int num)
	{
		if (num == lastanimation) return;
		if (num > animations.Count) return;
		
		currentAnimation = num;	
		currAnimation = animations[currentAnimation];
		currentFrame = animations[currentAnimation].frameStart;
		lastanimation = currentAnimation;
	}
예제 #3
0
 void Start() {
     m_renderer = GetComponent<SpriteRenderer>();
     m_currentFrameTime = 0f;
     m_currentFrameIndex = 0;
     m_animationRunning = false;
     if (animations.Length > 0) {
         m_anim = animations[0];
     }
     else {
         m_anim = null;
     }
 }
예제 #4
0
파일: BodyView.cs 프로젝트: toyboot4e/Rot
        Anim onPosChange(RlEv.PosChange posChange)
        {
            switch (posChange.cause.ev)
            {
            case RlEv.Walk walk:
                var body = walk.entity.get <Body>();
                var next = body.pos + walk.dir.vec;

                var tween     = _s.viewUtil.walk(walk.entity, next);
                var tweenAnim = Anim.tween(tween).setKind(AnimationKind.Parallel);
                return(tweenAnim);

            default:
                posChange.entity.get <CharaView>().forceUpdatePos();
                return(null);
            }
        }
예제 #5
0
        protected virtual void FixedUpdate()
        {
            if (!Health.IsDead && IsAware)
            {
                Anim.SetTrigger("Aware");
                FaceDirection(Targeting.Target.transform.position.x - transform.position.x);

                if (TimeBetweenAttacks < TimeSinceLastAttack && IsInAttackRange && !TargetIsDead && !IsGrappled)
                {
                    Attack();
                    TimeSinceLastAttack = 0;
                }

                MoveToTarget();
                FaceAimDirection();
            }
        }
    public virtual void YAxisAnimations()
    {
        bool grounded = WalkingPlayer.GetGrounded();

        Anim.SetBool("Grounded", grounded);

        if (grounded == LastGrounded)
        {
            return;
        }

        LastGrounded = grounded;
        if (LastGrounded)
        {
            ImpactOnFlootParticles.Play();
        }
    }
예제 #7
0
 // 随机攻击(普通攻击)
 public override void attack(GameCharacter target)
 {
     if (CurrentCoolDown == CoolDown)
     {
         if (checkHit(target))
         {
             hit(target, getDamageType(), BasicDamage, MyDamageType);
         }
         stop();
         Locked = true;
         Invoke("cure", 1.0f);
         Anim.Play("ladyDNormalAttack");
         CurrentCoolDown = 0;
         Target          = target;
         Invoke("finishAttack", 0.5f);
     }
 }
예제 #8
0
    public bool SendCompletedCircles(int completedCircles)
    {
        RepairHatchEvent rhe  = GetEvent() as RepairHatchEvent;
        bool             temp = rhe.ReceiveCompletedCircles(completedCircles);

        if (temp)
        {
            Anim.SetBool("Active", false);
            Audio_Cues[1].Pause();
            Audio_Cues[2].Pause();
            Audio_Cues[3].Play();

            TooltipPrompter.Instance.SetRotateLTrigger(false);
            return(true);
        }
        return(false);
    }
예제 #9
0
 public override void activateE()
 {
     if (canAttack)
     {
         CooldownE = false;
         canMove   = false;
         IndE.StartCooldown(CDE, this, 3);
         dashLoc = ELocation.transform.position;
         forceStopMoving();
         graphics.transform.rotation = EIndicator.transform.rotation;
         Anim.SetTrigger("E");
         Anim.SetBool("isAttacking", true);
         Anim.SetBool("isIdle", false);
         canAttack   = false;
         NewPosition = dashLoc;
     }
 }
예제 #10
0
    private void OnFire()
    {
        AnimatorStateInfo info = Anim.GetCurrentAnimatorStateInfo(0);

        if (!info.IsName("Fire"))
        {
            Anim.SetInteger("State", (int)State);
        }
        else
        {
            if (info.normalizedTime >= 1.0f)
            {
                CanMove = true;
                State   = E_State.Move;
            }
        }
    }
예제 #11
0
    // Update is called once per frame
    void Update()
    {
        float t           = Time.time * 4.0f % frames.Count;
        float interpolate = t % 1.0f;

        interpolate = easingFunction(0.0f, 1.0f, interpolate);
        int         frame  = (int)Mathf.Floor(t);
        List <Anim> bones1 = frames[frame];
        List <Anim> bones2 = frames[(frame + 1) % frames.Count];

        for (int i = 0; i < bones1.Count; ++i)
        {
            Anim a = bones1[i];
            Anim b = bones2[i];
            a.transform.localEulerAngles = Vector3.Slerp(a.value, b.value, interpolate);
        }
    }
예제 #12
0
    private void OnBellow()
    {
        AnimatorStateInfo info = Anim.GetCurrentAnimatorStateInfo(0);

        if (!info.IsName("Bellow"))
        {
            Anim.SetInteger("State", (int)State);
        }
        else
        {
        }

        if (BellowTime >= 8.0f)
        {
            BellowTime = 0;
            State      = E_State.Attack;
            for (int i = 0; i < UsedHitList.Count; ++i)
            {
                UsedHitList[i].DisableCollider();
            }
            ioo.gameMode.TimeScale(1);
            ioo.gameMode.Player.Pause = false;
            UsedHitList.Clear();
            MeshCollider.enabled = true;
            EventDispatcher.TriggerEvent(EventDefine.Event_Gorge_Boss_QTE, UsedHitList);
        }
        else
        {
            BellowTime += ioo.nonStopTime.deltaTime;

            if (UsedHitList.Count == 0)
            {
                BellowTime = 0;
                State      = E_State.Hurt;
                for (int i = 0; i < UsedHitList.Count; ++i)
                {
                    UsedHitList[i].DisableCollider();
                }
                ioo.gameMode.TimeScale(1);
                ioo.gameMode.Player.Pause = false;
                MeshCollider.enabled      = true;
                OnDamage(-25, true);
                EventDispatcher.TriggerEvent(EventDefine.Event_Gorge_Boss_QTE, UsedHitList);
            }
        }
    }
예제 #13
0
    IEnumerator SaveAnimationCoroutine(Anim newAnim)
    {
        yield return(FileBrowser.WaitForSaveDialog(false, @"Assets\Resources\Animations\", "Save Animation", "Save"));

        if (FileBrowser.Success)
        {
            string path     = FileBrowser.Result;
            string fileName = FileBrowserHelpers.GetFilename(FileBrowser.Result);
            newAnim.AnimationName = fileName.Replace(".txt", "");
            //FileBrowserHelpers.CreateFileInDirectory(@"Assets\Resources\Animations\",fileName);
            HandleTextFile.WriteString(path, newAnim.Code /*GetCleanCode(newAnim.Code)*/);
            AnimationData.Instance.AddAnim(newAnim);
            AnimationData.Instance.selectedAnim = newAnim;
            MenuManager.Instance.UpdateAnimations();
            MenuManager.Instance.SetSelectedAnimation(newAnim.AnimationName);
        }
    }
예제 #14
0
    public virtual void SetAnimationParameter(EnemyAnimatorParameter animParameter)
    {
        switch (animParameter)
        {
        case EnemyAnimatorParameter.Attack:
            AttackStateStarted();
            break;

        case EnemyAnimatorParameter.Hit:
        case EnemyAnimatorParameter.Revive:
        case EnemyAnimatorParameter.Die:
            AttackStateFinished();
            break;
        }

        Anim.SetTrigger(animParameterDic[animParameter]);
    }
    /// <summary>
    /// Serpent boss attack choice strategy function
    /// </summary>
    /// <returns>Whether an attack was chosen or not</returns>
    public override bool ChooseAttack()
    {
        float randNum = Random.Range(0f, 1f);

        if (randNum <= primaryAttackProbability)
        {
            AttackCooldown = primaryAttackCooldown;
            Anim.SetTrigger(Random.Range(0f, 1f) < 0.5f ? "ClawLeftAttack" : "ClawRightAttack");
        }
        else
        {
            AttackCooldown = secondaryAttackCooldown;
            Anim.SetTrigger("BiteAttack");
        }

        return(true);
    }
예제 #16
0
        /// <summary>Enable Optional Animator Parameters on the Animator Controller;</summary>
        protected virtual void OptionalAnimatorParameters()
        {
            hasUpDown          = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Float, hash_UpDown);
            hasDeltaAngle      = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Float, hash_DeltaAngle);
            hasSlope           = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Float, hash_Slope);
            hasSpeedMultiplier = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Float, hash_SpeedMultiplier);
            hasStateTime       = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Float, hash_StateTime);
            hasStance          = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Int, hash_Stance);
            hasRandom          = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Int, hash_Random);
            hasAnimHeight      = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Float, hash_AnimHeight);
            hasStateStatus     = MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Int, hash_StateStatus);

            if (MalbersTools.FindAnimatorParameter(Anim, AnimatorControllerParameterType.Int, hash_Type)) //This is only done once!
            {
                Anim.SetInteger(hash_Type, animalType);
            }
        }
예제 #17
0
 public override void activateQ()
 {
     if (canAttack)
     {
         CooldownQ = false;
         canMove   = false;
         IndQ.StartCooldown(CDQ, this, 1);
         forceStopMoving();
         PunchLoc    = kb.SpotToHit.transform.position;
         kb.location = PunchLoc;
         graphics.transform.rotation = QIndicator.transform.rotation;
         Anim.SetTrigger("Q");
         Anim.SetBool("isAttacking", true);
         Anim.SetBool("isIdle", false);
         canAttack = false;
     }
 }
예제 #18
0
        void Update()
        {
            currentAnimState = Anim.GetCurrentAnimatorStateInfo(0);             //Store the Current Animation State on the Base Layer
            nextAnimState    = Anim.GetNextAnimatorStateInfo(0);                //Store the Next    Animation State on the Base Layer

            if (anim.updateMode != AnimatorUpdateMode.AnimatePhysics)
            {
                RayCasting();
                FixPosition(Time.deltaTime);
                AdditionalTurn(Time.deltaTime);                                 //Apply Additional Turn movement ON UPDATE
                AdditionalSpeed(Time.deltaTime);                                //Apply Speed movement Turn movement ON UPDATE
                Falling();
                Swimming(Time.deltaTime);                                       //Calculate Swimming Logic when not falling on Update
                UpdatePlatformMovement();
                ApplyDeltaTransform();
            }
        }
예제 #19
0
 public override void StopAnim()
 {
     if (agent.isOnNavMesh)
     {
         Anim.SetBool("Attacking", false);
         if (AOE)
         {
             IsAtTarget = true;
             Anim.SetBool("AOESpell", true);
         }
         else if (Target != null && agent.remainingDistance <= agent.stoppingDistance)
         {
             AttackTarget();
         }
     }
     IsAtTarget = false;
 }
예제 #20
0
        private IEnumerator AttackRoutine(HexCell target, Action attackHitCallback)
        {
            Model.LookAt(target.transform);

            yield return(new WaitForSeconds(0.3f));

            Anim.SetTrigger(AnimRangedAttackTrigger);
            yield return(new WaitForSeconds(0.15f));

            var arrow    = Instantiate(projectile);
            var startPos = currentModel.GetProjectileStartPos();
            var endPos   = target.transform.position;

            endPos.y = 0.4f;

            arrow.Shoot(startPos, endPos, 4f, attackHitCallback);
        }
예제 #21
0
        protected override bool UpdateCurrentActionString()
        {
            string doingAnim = Anim.GetCurrentAnimatorClipInfo(0)[0].clip.name;

            CurAction = "";
            if (doingAnim != "neutral")
            {
                CurAction = actionSeperator + doingAnim;
            }
            if (kuriTextManager.IsTalking)
            {
                CurAction += actionSeperator + kuriTextManager.CurTextCommand.ToString();
            }

            // TODO: Movement when doing the movement actions
            return(CurAction != "");
        }
예제 #22
0
파일: UnitAnimMgr.cs 프로젝트: flzzyf/HOMMS
    IEnumerator PlayAnimationCor(Unit _unit, Anim _anim)
    {
        PlayAnimStart(_unit);

        //当前版本动画不全,如果缺失上下攻击动画,直接播放攻击动画
        if ((_anim == Anim.Attack_Up || _anim == Anim.Attack_Down) && !hasAnimation(_unit, _anim))
        {
            _anim = Anim.Attack;
        }

        _unit.animator.Play(_anim.ToString());
        float time = GetAnimationLength(_unit, _anim);

        yield return(new WaitForSeconds(time));

        PlayAnimEnd(_unit);
    }
예제 #23
0
    public bool AddPress()
    {
        bool temp = ((RepairPumpEvent)GetEvent()).AddPress();

        if (temp)
        {
            Anim.SetBool("Active", false);
            Audio_Cues[1].Pause();
            Audio_Cues[2].Pause();
            Audio_Cues[3].Play();

            TooltipPrompter.Instance.SetSmashA(false);

            return(true);
        }
        return(false);
    }
예제 #24
0
    public override IEnumerator Fire()
    {
        if (!CanFire)
        {
            yield return(null);
        }
        else
        {
            CanFire = false;
            Anim.Play("Shoot", -1, 0);
            AudioSource.Play();
            Shoot();
            yield return(new WaitForSeconds(FireRate));

            CanFire = true;
        }
    }
예제 #25
0
    public override void StartAttack()
    {
        AttackSpeed = GameManager.Instance.LocalPlayer.SeetAttackSpeed(AttackSpeed);
        FX.EffectPlay(FX.PCS.PC_SWING);

        if (Anim.GetFloat("State") == 0)
        {
            StopCoroutine(CAttack);
            CAttack = Attack1();
            StartCoroutine(CAttack);
        }
        else
        {
            StopCoroutine(CAttack);
            StartCoroutine(Attack2());
        }
    }
예제 #26
0
        /// <summary>
        /// Things to do every Frame
        /// </summary>
        public virtual void UpdateSettings()
        {
            CurrentAnimState = Anim.GetCurrentAnimatorStateInfo(0).tagHash;         //Store the Current Animation State on the Base Layer
            NextAnimState    = Anim.GetNextAnimatorStateInfo(0).tagHash;            //Store the Next    Animation State on the Base Layer
            StateTime        = Anim.GetCurrentAnimatorStateInfo(0).normalizedTime;  //State Time

            if (LastAnimationTag != AnimState)
            {
                LastAnimationTag = AnimState;                                      //Check if there's an animation Change and INVOKE THE EVENT
            }
            T_Up      = _transform.up;
            T_Right   = _transform.right;
            T_Forward = _transform.forward;

            FrameCounter++;                                  //This is used for reducing the raycasting
            FrameCounter %= 100000;                          //This is used for reducing the raycasting
        }
예제 #27
0
    // Use this for initialization
    void Start()
    {
        Debug.Log("testing");
        connector = new Connector();

        queue = new Queue();

        IPAddress  ipAddress = IPAddress.Parse("172.16.236.105");
        IPEndPoint endpoint  = new IPEndPoint(ipAddress, 6070);

        string result = connector.fnConnectResult(endpoint);

        Debug.Log(result);
        connector.setOnActionListener(this);
        connector.setRecvLogger(this);

//		GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
//		cube.transform.parent = imageTarget.transform;
//		cube.transform.position = player.transform.position + new Vector3(1, 0, 0) * 100f;
//		cube.transform.localScale = new Vector3 (0.108f, 0.108f, 0.108f);
//
        Debug.Log("Local scale:" + reference.transform.localScale[0]);


        Anim anim1 = new Anim();

        anim1.from_x = 0;
        anim1.from_y = 0;
        anim1.from_z = 0;
        anim1.to_x   = 0;
        anim1.to_y   = 0;
        anim1.to_z   = 3;

        Anim anim2 = new Anim();

        anim2.from_x = 0;
        anim2.from_y = 0;
        anim2.from_z = 2;
        anim2.to_x   = 0;
        anim2.to_y   = 0;
        anim2.to_z   = 3;

        animList = new Anim[2] {
            anim1, anim2
        };
    }
    /// <summary>
    /// Frightfly attack strategy function
    /// </summary>
    /// <returns>Whether an attack was chosen or not</returns>
    public override bool ChooseAttack()
    {
        float randNum = Random.Range(0f, 1f);

        if (randNum <= primaryAttackProbability)
        {
            AttackCooldown = primaryAttackCooldown;
            Anim.SetTrigger("PrimaryAttack");
        }
        else
        {
            AttackCooldown = secondaryAttackCooldown;
            Anim.SetTrigger("SecondaryAttack");
        }

        return(true);
    }
예제 #29
0
        public override void Draw(SpriteBatch spriteBatch, Loc offset)
        {
            if (Finished)
            {
                return;
            }

            Loc drawLoc   = GetDrawLoc(offset);
            Loc modOffset = new Loc(GraphicsManager.ScreenWidth - offset.X % GraphicsManager.ScreenWidth, GraphicsManager.ScreenHeight - offset.Y % GraphicsManager.ScreenHeight);

            drawLoc = drawLoc + modOffset;
            Vector2 drawDest = new Vector2(drawLoc.X % GraphicsManager.ScreenWidth, (drawLoc.Y - LocHeight) % GraphicsManager.ScreenHeight);

            DirSheet sheet = GraphicsManager.GetAttackSheet(Anim.AnimIndex);

            sheet.DrawDir(spriteBatch, drawDest, Anim.GetCurrentFrame(ActionTime, GraphicsManager.GetAttackSheet(Anim.AnimIndex).TotalFrames), Anim.GetDrawDir(Direction), Color.White * ((float)Anim.Alpha / 255));
        }
예제 #30
0
    private void Update()
    {
        if (Anim.GetBool(Jumping))
        {
            if (Rb.velocity.y < .1f)
            {
                Anim.SetBool(Falling, true);
                Anim.SetBool(Jumping, false);
            }
        }


        if (Rb.IsTouchingLayers(groundMask) && Anim.GetBool(Falling))
        {
            Anim.SetBool(Falling, false);
        }
    }
예제 #31
0
        public virtual void UpdateAnimator()
        {
            Crouching = Controller.CurrentState == ControllerState.Crouching;
            Proning   = Controller.CurrentState == ControllerState.Proning;

            Vector2 move = Controller.Movement.Speed.Vector;

            move /= Controller.Movement.Speed.Value.Max;

            if (Controller.CurrentState == ControllerState.Sprinting)
            {
                move *= 2;
            }

            Anim.SetFloat("Walk", move.y);
            Anim.SetFloat("Strafe", move.x);
        }
    // Update is called once per frame
    void Update()
    {
        if (Play != MoveMode.Forward)
        {
            Anim.ChangeFps(0);
            return;
        }
        else
        {
            Anim.ChangeFps(12);
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            GetHit(new DamageInfo());
        }

        var hInput = Input.GetAxis("Horizontal");

        if (hInput != 0)
        {
            if (OnFloor)
            {
                Anim.SetAnim("Walk");
            }
            AddVelocity(Vector2.right * (hInput * Time.deltaTime));
        }
        else
        {
            if (OnFloor)
            {
                Anim.SetAnim("Stand");
            }
        }
        if (OnFloor && Input.GetKeyDown(KeyCode.Space))
        {
            Anim.SetAnim("JumpStart");
            OnFloor = false;
            AddVelocity(Vector2.up * jumpPower);
        }

        if (Velocity.y < 0)
        {
            Anim.SetAnim("FallStart");
        }
    }
예제 #33
0
    //プレイヤーの攻撃とのあたり判定
    private void OnTriggerEnter(Collider collider)
    {
        //とりあえずタグで敵とのあたり判定
        //if(collider.gameObject.tag == Tag_Name)
        //{
        //    EnemyBase enemy = collider.gameObject.GetComponent<EnemyBase>();
        //    if (enemy == null)
        //    {
        //        return;
        //    }
        //    enemy.StopAnim();
        //    enemy.Dead();
        //    LevelUpdate(collider.gameObject.GetComponent<EnemyBase>().Exp);
        //    //collider.GetComponent<EnemyBase>().Dead();
        //    //プレイヤーの攻撃と接触したら吹っ飛ばす
        //    Vector3 force = collider.gameObject.transform.position - this.gameObject.transform.position;
        //    collider.gameObject.GetComponent<Rigidbody>().AddForce(force.normalized * Enemy_Fly[Level], ForceMode.Acceleration);
        //}

        if (!invincible)
        {
            //敵の攻撃との当たり判定
            if (collider.tag == "Attack")
            {
                LevelDownUpdate(2);         //敵の攻撃力を入れる
                Effect[(int)EffectNum.Dead].Play();
                //敵の攻撃に触れたらノックバックさせる
                this.gameObject.GetComponent <Rigidbody>().AddForce((this.transform.forward * -1.0f) * Move_Speed[Level] * Stagger_Power, ForceMode.VelocityChange);
                invincible   = true;
                stagger_time = Stagger_Time;
                //ノックバックモーションにする
                Anim.SetBool("knockback", true);
            }
        }

        if (collider.tag == "Clear")
        {
            Clear_Flag = true;
        }
        ////タグでステージとのあたり判定
        //if (collider.tag == "Stage")
        //{
        //    Dead_Flag = true;
        //}
    }
예제 #34
0
    public void ChangeAnim(string name)
    {
        if(currentAnim.animName != name)
        {
            //Cycle through each of the animations we've added in the inspector
            foreach(Anim anim in animations)
            {
                //If any match the name we're giving
                if(name == anim.animName)
                {
                    //Change to the corresponding animation
                    currentAnim = anim;

                    //Change to start fram
                    currentFrame = currentAnim.startFrame;

                    //Switch to starting frame of new animation
                    animTimer = 61;
                    break;
                }
            }
        }
    }
예제 #35
0
	public void SetAnimationRollOver(int num,int next)
	{
		if (num == lastanimation) return;
		if (num > animations.Count) return;
		
		currentAnimation = num;	
		currAnimation = animations[currentAnimation];
		currentFrame = animations[currentAnimation].frameStart;
		lastanimation = currentAnimation;
		RollOver = true;
		rollto_anim = next;
	}
예제 #36
0
        void pack(OgreXmlReader src_model, RW4Model model)
        {
            model.FileType = RW4Model.FileTypes.Model;

            RW4Skeleton skel = new RW4Skeleton();
            skel.unk1 = 0x8d6da0;
            skel.mat3 = new Matrices4x3()
            {
                items = new Mat4x3[] { new Mat4x3() { m = new float[] {
                1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 1.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f
            } } }
            };
            skel.mat4 = new Matrices4x4()
            {
                items = new Mat4x4[] { new Mat4x4() { m = new float[] {
            /*                1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 1.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f,*/
                0.0f, 1.0f, 0.0f, 0.0f,
               -1.0f, 0.0f, 0.0f, 0.0f,
                0.0f, 0.0f, 1.0f, 0.0f,
                0.0f, 0.0f, 0.0f, 0.0f
            } } }
            };
            skel.jointInfo = new RW4HierarchyInfo()
            {
                id = "skeleton1".FNV(),
                items = new RW4HierarchyInfo.Item[] {
                            new RW4HierarchyInfo.Item { index=0, name_fnv = "joint1".FNV(), flags=1, parent=null }
                        },
            };

            var anim = new Anim()
            {
                skeleton_id = skel.jointInfo.id,
                flags = 3,
                length = 1.25f,
                channel_names = (from j in skel.jointInfo.items select j.name_fnv).ToArray(),
            };
            anim.channel_frame_pose = new JointPose[,] {
                {
                    new JointPose{ qx=0, qy=0, qz=0, qs=1,
                                   tx=0, ty=0, tz=0,
                                   sx=1, sy=1, sz=1,
                                   time=1.25f }
                }
            };

            var mesh = new RW4Mesh()
            {
                vertices = new RW4VertexArray(),
                triangles = new RW4TriangleArray(),
            };
            mesh.vertices.unk2 = 0;  //< ?
            mesh.vertices.format = new VertexFormat() { blob = RW4Garbage.vertex_format };
            mesh.vertices.vertices = new Buffer<Vertex>(0);
            mesh.vertices.vertices.Assign(src_model.vertices);
            mesh.triangles.unk1 = 0;  //< ?
            mesh.triangles.triangles = new Buffer<Triangle>(0);
            mesh.triangles.triangles.Assign(src_model.triangles);

            var texture = new Texture()
            {
                width = 64,
                height = 64,
                mipmapInfo = 0x708,
                textureType = Texture.DXT5,
                unk1 = 0,
                texData = new TextureBlob() { blob = new byte[5488] }
            };
            var texture_format = new RW4TexMetadata()
            {
                unk_data_1 = RW4Garbage.texture_format_1,
                unk_data_2 = RW4Garbage.texture_format_2,
                texture = texture
            };
            var meshMaterial = new RWMeshMaterialAssignment()
            {
                mesh = mesh,
                mat = new RW4TexMetadata[] { texture_format }
            };

            model.AddObject(anim, Anim.type_code);
            model.AddObject(mesh.vertices.format, VertexFormat.type_code);
            model.AddObject(skel.mat4, Matrices4x4.type_code);
            model.AddObject(skel.mat3, Matrices4x3.type_code);
            skel.mat3.section.fixup_offsets.Add(16);   // !?
            model.AddObject(skel, RW4Skeleton.type_code);
            model.AddObject(mesh.triangles.triangles, Buffer<Triangle>.type_code);
            model.AddObject(mesh.triangles, RW4TriangleArray.type_code);
            model.AddObject(mesh, RW4Mesh.type_code);
            model.AddObject(texture_format, RW4TexMetadata.type_code);
            model.AddObject(meshMaterial, RWMeshMaterialAssignment.type_code);
            model.AddObject(skel.jointInfo, RW4HierarchyInfo.type_code);

            model.AddObject(mesh.vertices.vertices, Buffer<Vertex>.type_code);
            model.AddObject(mesh.vertices, RW4VertexArray.type_code);

            model.AddObject(texture.texData, TextureBlob.type_code);
            model.AddObject(texture, Texture.type_code);
        }
예제 #37
0
        public StateMachine(GenericRCOLResource jazzResource)
            : this("")
        {
            if (jazzResource == null)
            {
                throw new ArgumentNullException("jazzResource");
            }
            GenericRCOLResource.ChunkEntryList chunkEntries
                = jazzResource.ChunkEntries;
            if (chunkEntries == null || chunkEntries.Count == 0)
            {
                throw new ArgumentException(
                    "RCOL Resource is empty", "jazzResource");
            }
            KeyNameReg.RefreshKeyNameMaps();
            uint hash;
            string name;
            int i, j, index = -1;
            State state;
            ActorDefinition ad;
            ParamDefinition pd;
            DecisionGraphNode dgn;
            JazzStateMachine jazzSM = null;
            GenericRCOLResource.ChunkEntry ce;
            AChunkObject[] chunks = new AChunkObject[chunkEntries.Count];
            List<ActorDefinition> actorDefs = new List<ActorDefinition>();
            List<ParamDefinition> paramDefs = new List<ParamDefinition>();

            #region Phase 1: Instantiate Chunks and Copy over value fields
            for (i = 0; i < chunkEntries.Count; i++)
            {
                ce = chunkEntries[i];
                hash = ce.TGIBlock.ResourceType;
                switch (hash)
                {
                    case PlayAnimationNode.ResourceType:
                        JazzPlayAnimationNode jpan
                            = ce.RCOLBlock as JazzPlayAnimationNode;
                        PlayAnimationNode lan = new PlayAnimationNode();
                        lan.ClipKey = new RK(jpan.ClipResource);
                        lan.TrackMaskKey = new RK(jpan.TkmkResource);
                        // lan.SlotSetup copied over later
                        lan.AdditiveClipKey
                            = new RK(jpan.AdditiveClipResource);
                        lan.ClipPattern = jpan.Animation;
                        lan.AdditiveClipPattern = jpan.AdditiveAnimation;
                        lan.Flags = jpan.AnimationNodeFlags;
                        lan.Priority = jpan.AnimationPriority1;
                        lan.BlendInTime = jpan.BlendInTime;
                        lan.BlendOutTime = jpan.BlendOutTime;
                        lan.Speed = jpan.Speed;
                        // lan.Actor set later
                        lan.TimingPriority = jpan.TimingPriority;
                        chunks[i] = lan;
                        break;
                    case StopAnimationNode.ResourceType:
                        JazzStopAnimationNode jsan
                            = ce.RCOLBlock as JazzStopAnimationNode;
                        StopAnimationNode san = new StopAnimationNode();
                        san.Flags = jsan.AnimationFlags;
                        san.Priority = jsan.AnimationPriority1;
                        san.BlendInTime = jsan.BlendInTime;
                        san.BlendOutTime = jsan.BlendOutTime;
                        san.Speed = jsan.Speed;
                        // san.Actor set later
                        san.TimingPriority = jsan.TimingPriority;
                        chunks[i] = san;
                        break;
                    case ActorOperationNode.ResourceType:
                        JazzActorOperationNode jaon
                            = ce.RCOLBlock as JazzActorOperationNode;
                        ActorOperationNode aon
                            = new ActorOperationNode(jaon.ActorOp);
                        // aon.Target set later
                        aon.Operand = jaon.Operand != 0;
                        chunks[i] = aon;
                        break;
                    case CreatePropNode.ResourceType:
                        JazzCreatePropNode jcpn
                            = ce.RCOLBlock as JazzCreatePropNode;
                        CreatePropNode cpn = new CreatePropNode();
                        // cpn.PropActor set later
                        // cpn.PropParameter set later
                        cpn.PropKey = new RK(jcpn.PropResource);
                        chunks[i] = cpn;
                        break;
                    case RandomNode.ResourceType:
                        JazzRandomNode jrand
                            = ce.RCOLBlock as JazzRandomNode;
                        RandomNode rand = new RandomNode();
                        // rand.Slices set later
                        rand.Flags = jrand.Properties;
                        chunks[i] = rand;
                        break;
                    case SelectOnParameterNode.ResourceType:
                        // sopn.Parameter set later
                        // sopn.Cases set later
                        chunks[i] = new SelectOnParameterNode();
                        break;
                    case SelectOnDestinationNode.ResourceType:
                        // sodn.Cases set later
                        chunks[i] = new SelectOnDestinationNode();
                        break;
                    case NextStateNode.ResourceType:
                        // nsn.NextState set later
                        chunks[i] = new NextStateNode();
                        break;
                    case DecisionGraph.ResourceType:
                        // dg.State set later
                        // dg.DecisionMakers set later
                        // dg.EntryPoints set later
                        chunks[i] = new DecisionGraph();
                        break;
                    case State.ResourceType:
                        JazzState js = ce.RCOLBlock as JazzState;
                        hash = js.NameHash;
                        if (!KeyNameReg.TryFindName(hash, out name))
                            name = KeyNameReg.UnhashName(hash);
                        state = new State(name);
                        state.Flags = js.Properties;
                        // state.DecisionGraph set later
                        // state.Transitions set later
                        state.AwarenessOverlayLevel
                            = js.AwarenessOverlayLevel;
                        chunks[i] = state;
                        break;
                    case ParamDefinition.ResourceType:
                        JazzParameterDefinition jpd
                            = ce.RCOLBlock as JazzParameterDefinition;
                        hash = jpd.NameHash;
                        if (!KeyNameReg.TryFindName(hash, out name))
                            name = KeyNameReg.UnhashName(hash);
                        pd = new ParamDefinition(name);

                        hash = jpd.DefaultValue;
                        if (!KeyNameReg.TryFindName(hash, out name))
                            name = KeyNameReg.UnhashName(hash);
                        pd.DefaultValue = name;
                        chunks[i] = pd;
                        paramDefs.Add(pd);
                        break;
                    case ActorDefinition.ResourceType:
                        JazzActorDefinition jad
                            = ce.RCOLBlock as JazzActorDefinition;
                        hash = jad.NameHash;
                        if (!KeyNameReg.TryFindName(hash, out name))
                            name = KeyNameReg.UnhashName(hash);
                        ad = new ActorDefinition(name);
                        chunks[i] = ad;
                        actorDefs.Add(ad);
                        break;
                    case StateMachine.ResourceType:
                        if (index != -1)
                        {
                            throw new Exception(
                                "More than one State Machine in RCOL");
                        }
                        index = i;
                        jazzSM = ce.RCOLBlock as JazzStateMachine;
                        hash = jazzSM.NameHash;
                        if (hash == 0)
                        {
                            name = null;
                            this.bNameIsHash = true;
                        }
                        else if (!KeyNameReg.TryFindName(hash, out name))
                        {
                            name = KeyNameReg.UnhashName(hash);
                            this.bNameIsHash = true;
                        }
                        else
                        {
                            this.bNameIsHash = false;
                        }
                        this.mName = name;
                        this.mNameHash = hash;
                        // this.mActorDefinitions set later
                        // this.mParameterDefinitions set later
                        // this.mStates set later
                        this.mFlags = jazzSM.Properties;
                        this.mDefaultPriority = jazzSM.AutomationPriority;
                        this.mAwarenessOverlayLevel
                            = jazzSM.AwarenessOverlayLevel;
                        chunks[i] = this;
                        break;
                }
            }
            if (index == -1)
            {
                throw new Exception("RCOL does not contain a Jazz Graph");
            }
            #endregion

            #region Phase 2: Copy over fields referencing other chunks
            for (i = 0; i < chunkEntries.Count; i++)
            {
                ce = chunkEntries[i];
                switch (ce.TGIBlock.ResourceType)
                {
                    case PlayAnimationNode.ResourceType:
                        JazzPlayAnimationNode jpan
                            = ce.RCOLBlock as JazzPlayAnimationNode;
                        PlayAnimationNode lan
                            = chunks[i] as PlayAnimationNode;
                        index = jpan.ActorDefinitionIndex.TGIBlockIndex;
                        lan.Actor = index < 0
                            ? null : chunks[index + 1] as ActorDefinition;
                        break;
                    case StopAnimationNode.ResourceType:
                        JazzStopAnimationNode jsan
                            = ce.RCOLBlock as JazzStopAnimationNode;
                        StopAnimationNode san
                            = chunks[i] as StopAnimationNode;
                        index = jsan.ActorDefinitionIndex.TGIBlockIndex;
                        san.Actor = index < 0
                            ? null : chunks[index + 1] as ActorDefinition;
                        break;
                    case ActorOperationNode.ResourceType:
                        JazzActorOperationNode jaon
                            = ce.RCOLBlock as JazzActorOperationNode;
                        ActorOperationNode aon
                            = chunks[i] as ActorOperationNode;
                        index = jaon.ActorDefinitionIndex.TGIBlockIndex;
                        aon.Actor = index < 0
                            ? null : chunks[index + 1] as ActorDefinition;
                        break;
                    case CreatePropNode.ResourceType:
                        JazzCreatePropNode jcpn
                            = ce.RCOLBlock as JazzCreatePropNode;
                        CreatePropNode cpn = chunks[i] as CreatePropNode;
                        index = jcpn.ActorDefinitionIndex.TGIBlockIndex;
                        cpn.PropActor = index < 0
                            ? null : chunks[index + 1] as ActorDefinition;
                        index = jcpn.ParameterDefinitionIndex.TGIBlockIndex;
                        cpn.PropParam = index < 0
                            ? null : chunks[index + 1] as ParamDefinition;
                        break;
                    case RandomNode.ResourceType:
                        JazzRandomNode jrand = ce.RCOLBlock as JazzRandomNode;
                        RandomNode rand = chunks[i] as RandomNode;
                        RandomNode.Slice slice;
                        List<RandomNode.Slice> slices = rand.Slices;
                        foreach (JazzRandomNode.Outcome oc in jrand.Outcomes)
                        {
                            slice = new RandomNode.Slice(oc.Weight);
                            foreach (GenericRCOLResource.ChunkReference cr
                                in oc.DecisionGraphIndexes)
                            {
                                index = cr.TGIBlockIndex;
                                dgn = index < 0 ? null
                                    : chunks[index + 1] as DecisionGraphNode;
                                slice.Targets.Add(dgn);
                            }
                            slices.Add(slice);
                        }
                        break;
                    case SelectOnParameterNode.ResourceType:
                        JazzSelectOnParameterNode jsopn
                            = ce.RCOLBlock as JazzSelectOnParameterNode;
                        SelectOnParameterNode sopn
                            = chunks[i] as SelectOnParameterNode;
                        index = jsopn.ParameterDefinitionIndex.TGIBlockIndex;
                        sopn.Parameter = index < 0 ? null
                            : chunks[index + 1] as ParamDefinition;
                        foreach (JazzSelectOnParameterNode.Match mp
                            in jsopn.Matches)
                        {
                            hash = mp.TestValue;
                            if (!KeyNameReg.TryFindName(hash, out name))
                                name = KeyNameReg.UnhashName(hash);
                            foreach (GenericRCOLResource.ChunkReference cr
                                in mp.DecisionGraphIndexes)
                            {
                                index = cr.TGIBlockIndex;
                                dgn = index < 0 ? null
                                    : chunks[index + 1] as DecisionGraphNode;
                                sopn.AddCaseTarget(name, dgn);
                            }
                        }
                        break;
                    case SelectOnDestinationNode.ResourceType:
                        JazzSelectOnDestinationNode jsodn
                            = ce.RCOLBlock as JazzSelectOnDestinationNode;
                        SelectOnDestinationNode sodn
                            = chunks[i] as SelectOnDestinationNode;
                        foreach (JazzSelectOnDestinationNode.Match md
                            in jsodn.Matches)
                        {
                            index = md.StateIndex.TGIBlockIndex;
                            state = index < 0 ? null
                                : chunks[index + 1] as State;
                            foreach (GenericRCOLResource.ChunkReference cr
                                in md.DecisionGraphIndexes)
                            {
                                index = cr.TGIBlockIndex;
                                dgn = index < 0 ? null
                                    : chunks[index + 1] as DecisionGraphNode;
                                sodn.AddCaseTarget(state, dgn);
                            }
                        }
                        break;
                    case NextStateNode.ResourceType:
                        JazzNextStateNode jnsn
                            = ce.RCOLBlock as JazzNextStateNode;
                        NextStateNode nsn = chunks[i] as NextStateNode;
                        index = jnsn.StateIndex.TGIBlockIndex;
                        nsn.NextState = index < 0 ? null
                            : chunks[index + 1] as State;
                        break;
                    case DecisionGraph.ResourceType:
                        JazzDecisionGraph jdg
                            = ce.RCOLBlock as JazzDecisionGraph;
                        DecisionGraph dg = chunks[i] as DecisionGraph;
                        foreach (GenericRCOLResource.ChunkReference dm
                            in jdg.OutboundDecisionGraphIndexes)
                        {
                            index = dm.TGIBlockIndex;
                            dgn = index < 0 ? null
                                : chunks[index + 1] as DecisionGraphNode;
                            dg.AddDecisionMaker(dgn);
                        }
                        foreach (GenericRCOLResource.ChunkReference ep
                            in jdg.InboundDecisionGraphIndexes)
                        {
                            index = ep.TGIBlockIndex;
                            dgn = index < 0 ? null
                                : chunks[index + 1] as DecisionGraphNode;
                            dg.AddEntryPoint(dgn);
                        }
                        break;
                    case State.ResourceType:
                        State transition;
                        JazzState js = ce.RCOLBlock as JazzState;
                        state = chunks[i] as State;
                        index = js.DecisionGraphIndex.TGIBlockIndex;
                        state.DecisionGraph = index < 0 ? null
                            : chunks[index + 1] as DecisionGraph;
                        foreach (GenericRCOLResource.ChunkReference trans
                            in js.OutboundStateIndexes)
                        {
                            index = trans.TGIBlockIndex;
                            transition = index < 0 ? null
                                : chunks[index + 1] as State;
                            state.AddTransition(transition);
                        }
                        break;
                    case ParamDefinition.ResourceType:
                    case ActorDefinition.ResourceType:
                        break;
                    case StateMachine.ResourceType:
                        jazzSM = ce.RCOLBlock as JazzStateMachine;
                        foreach (GenericRCOLResource.ChunkReference jad
                            in jazzSM.ActorDefinitionIndexes)
                        {
                            index = jad.TGIBlockIndex;
                            ad = index < 0 ? null
                                : chunks[index + 1] as ActorDefinition;
                            this.AddActorDefinition(ad);
                        }
                        foreach (GenericRCOLResource.ChunkReference jpd
                            in jazzSM.PropertyDefinitionIndexes)
                        {
                            index = jpd.TGIBlockIndex;
                            pd = index < 0 ? null
                                : chunks[index + 1] as ParamDefinition;
                            this.AddParamDefinition(pd);
                        }
                        foreach (GenericRCOLResource.ChunkReference jst
                            in jazzSM.StateIndexes)
                        {
                            index = jst.TGIBlockIndex;
                            state = index < 0  ? null
                                : chunks[index + 1] as State;
                            this.AddState(state);
                        }
                        break;
                }
            }
            #endregion

            #region Phase 3: Copy over animation slots and Find "Extras"
            for (i = 0; i < chunkEntries.Count; i++)
            {
                ce = chunkEntries[i];
                switch (ce.TGIBlock.ResourceType)
                {
                    case PlayAnimationNode.ResourceType:
                        JazzPlayAnimationNode jpan
                            = ce.RCOLBlock as JazzPlayAnimationNode;
                        PlayAnimationNode lan
                            = chunks[i] as PlayAnimationNode;
                        SlotSetupBuilder ssb = lan.SlotSetup;
                        foreach (JazzPlayAnimationNode.ActorSlot slot
                            in jpan.ActorSlots)
                        {
                            ssb.AddSlotAssignment(slot.ChainId, slot.SlotId,
                                slot.ActorNameHash, slot.SlotNameHash);
                        }
                        foreach (JazzPlayAnimationNode.ActorSuffix suffix
                            in jpan.ActorSuffixes)
                        {
                            hash = suffix.ActorNameHash;
                            ad = null;
                            if (hash != 0)
                            {
                                index = -1;
                                for (i = actorDefs.Count - 1;
                                     i >= 0 && index == -1; i--)
                                {
                                    ad = actorDefs[i];
                                    if (ad.NameHash == hash)
                                    {
                                        index = i;
                                    }
                                }
                                if (index < 0)
                                {
                                    if (!KeyNameReg.TryFindName(hash, out name))
                                        name = KeyNameReg.UnhashName(hash);
                                    ad = new ActorDefinition(name);
                                    actorDefs.Add(ad);
                                    this.mExtraActors.Add(ad);
                                }
                            }
                            hash = suffix.SuffixHash;
                            pd = null;
                            if (hash != 0)
                            {
                                index = -1;
                                for (i = paramDefs.Count - 1;
                                     i >= 0 && index == -1; i--)
                                {
                                    pd = paramDefs[i];
                                    if (pd.NameHash == hash)
                                    {
                                        index = i;
                                    }
                                }
                                if (index < 0)
                                {
                                    if (!KeyNameReg.TryFindName(hash, out name))
                                        name = KeyNameReg.UnhashName(hash);
                                    pd = new ParamDefinition(name);
                                    paramDefs.Add(pd);
                                    this.mExtraParams.Add(pd);
                                }
                            }
                            ssb.AddNamespaceSlotSuffix(ad, pd);
                        }
                        break;
                    case State.ResourceType:
                        state = chunks[i] as State;
                        index = this.mStates.IndexOf(state);
                        if (index < 0)
                        {
                            this.mExtraStates.Add(state);
                        }
                        break;
                    case ParamDefinition.ResourceType:
                        pd = chunks[i] as ParamDefinition;
                        index = this.mParamDefinitions.IndexOf(pd);
                        if (index < 0)
                        {
                            this.mExtraParams.Add(pd);
                        }
                        break;
                    case ActorDefinition.ResourceType:
                        ad = chunks[i] as ActorDefinition;
                        index = this.mActorDefinitions.IndexOf(ad);
                        if (index < 0)
                        {
                            this.mExtraActors.Add(ad);
                        }
                        break;
                }
            }
            #endregion

            #region Phase 4: Copy over Animation CLIP Namespace Map
            RK rk;
            List<RK> rks = this.SlurpReferencedRKs();
            List<uint> foldedClipInstances = new List<uint>(rks.Count);
            for (i = rks.Count - 1; i >= 0; i--)
            {
                rk = rks[i];
                if (rk.TID == 0x6b20c4f3)
                {
                    hash = (uint)((rk.IID >> 0x20) ^ (rk.IID & 0xffffffff));
                    foldedClipInstances.Add(hash);
                }
                else
                {
                    rks.RemoveAt(i);
                }
            }
            index = 0;
            Anim animation;
            Anim[] animations = new Anim[jazzSM.Animations.Count];
            foreach (JazzStateMachine.Animation anim in jazzSM.Animations)
            {
                hash = anim.NameHash;
                if (!foldedClipInstances.Contains(hash))
                {
                    animation = new Anim();
                    animation.SrcFileHash = hash;
                    if (KeyNameReg.TryFindName(hash, out name))
                    {
                        animation.SrcFileName = name;
                        animation.SrcFileIsValid = true;
                    }
                    else
                    {
                        animation.SrcFileName
                            = KeyNameReg.UnhashName(hash);
                        animation.SrcFileIsValid = false;
                    }
                    hash = anim.Actor1Hash;
                    if (KeyNameReg.TryFindName(hash, out name))
                    {
                        animation.Namespace = name;
                    }
                    else
                    {
                        animation.Namespace
                            = string.Concat("0x", hash.ToString("X8"));
                    }
                    hash = anim.Actor2Hash;
                    ad = null;
                    if (hash != 0)
                    {
                        j = -1;
                        for (i = actorDefs.Count - 1; i >= 0 && j < 0; i--)
                        {
                            ad = actorDefs[i];
                            if (ad.NameHash == hash)
                            {
                                j = i;
                            }
                        }
                        if (j < 0)
                        {
                            if (!KeyNameReg.TryFindName(hash, out name))
                                name = KeyNameReg.UnhashName(hash);
                            ad = new ActorDefinition(name);
                            actorDefs.Add(ad);
                            this.mExtraActors.Add(ad);
                        }
                    }
                    animation.Actor = ad;
                    animations[index++] = animation;
                }
            }
            ulong clipHash;
            Dictionary<ulong, string> keyNameMap
                = new Dictionary<ulong, string>();
            for (i = index - 1; i >= 0; i--)
            {
                animation = animations[i];
                this.mNamespaceMap.SetNamespaceMap(
                    animation.SrcFileName,
                    animation.Namespace,
                    animation.Actor);
                if (animation.SrcFileIsValid)
                {
                    clipHash = FNVHash.HashString64(animation.SrcFileName);
                    keyNameMap[clipHash] = animation.SrcFileName;
                }
            }
            // Update the Key to Filename Map of the Namespace Map
            SortedDictionary<RK, string> k2fn
                = this.mNamespaceMap.KeyToFilenameMap;
            k2fn.Clear();
            for (i = rks.Count - 1; i >= 0; i--)
            {
                rk = rks[i];
                if (keyNameMap.TryGetValue(rk.IID, out name) ||
                    KeyNameReg.TryFindName(rk.IID, out name))
                {
                    k2fn[rk] = name;
                }
            }
            #endregion
        }
예제 #38
0
 public void SetRandomFrame()
 {
     currentAnim = animations[startAnim];
     currentFrame = Random.Range(currentAnim.startFrame, currentAnim.startFrame + currentAnim.animFrames);
 }
예제 #39
0
    // Use this for initialization
    void Start()
    {
        sprite = this.renderer.material;

        //Set to starting animation
        currentAnim = animations[startAnim];

        //
        currentSheet = spriteSheets[currentAnim.sheetNum];

        if(currentFrame == 0)
        {
            currentFrame = currentAnim.startFrame;
        }

        //Assign sprite, find width/height of frames, set sprite scale
        FrameData();

        //Set the texture offset to be friendly with our frames
        float offsetX = (frameWidth * (currentFrame % currentSheet.framesPerRow));
        float offsetY = (frameHeight*(rowNumber-1))+(currentFrame/currentSheet.framesPerRow * frameHeight);
        sprite.mainTextureOffset = new Vector2(offsetX,offsetY);

        //Start anim if ready
        if (playOnStart) Play();
    }
예제 #40
0
 protected void SetMoveAnim( Anims_Generic.Anim moveAnim , float time)
 {
     LastMoveAnim = CurrentMoveAnim;
     CurrentMoveAnim = moveAnim;
     MoveAnimTransitionTime = time;
     if(MoveAnimTransitionTime>0f)
         MoveAnimLerp = 1f;
 }
예제 #41
0
 void Awake()
 {
     AnimIdentity = None;
     CurrentMoveAnim = None;
     LastMoveAnim = None;
     CurrentActionAnim = None;
 }
예제 #42
0
 protected void SetAnimIdentity( Anims_Generic.Anim identity )
 {
     AnimIdentity = identity;
 }
예제 #43
0
    protected void SetActionAnim( Anims_Generic.Anim actionAnim , float time, bool shouldLoop, bool canInterrupt)
    {
        if(CanInterruptAction==false && DoActionAnim==true){return;}

        CurrentActionAnim = actionAnim;
        ActionAnimTransitionTime = time;
        DoActionAnim = true;
        ActionAnimFrame = 0f;
        LoopActionAnim = shouldLoop;
        CanInterruptAction = canInterrupt;
    }
예제 #44
0
    // Use this for initialization
    void Start()
    {
        Debug.Log ("testing");
        connector = new Connector();

        queue = new Queue ();

        IPAddress ipAddress = IPAddress.Parse ("172.16.236.105");
        IPEndPoint endpoint = new IPEndPoint (ipAddress, 6070);

        string result = connector.fnConnectResult (endpoint);
        Debug.Log (result);
        connector.setOnActionListener (this);
        connector.setRecvLogger (this);

        //		GameObject cube = GameObject.CreatePrimitive (PrimitiveType.Cube);
        //		cube.transform.parent = imageTarget.transform;
        //		cube.transform.position = player.transform.position + new Vector3(1, 0, 0) * 100f;
        //		cube.transform.localScale = new Vector3 (0.108f, 0.108f, 0.108f);
        //
        Debug.Log ("Local scale:" + reference.transform.localScale[0]);

        Anim anim1 = new Anim ();

        anim1.from_x = 0;
        anim1.from_y = 0;
        anim1.from_z = 0;
        anim1.to_x = 0;
        anim1.to_y = 0;
        anim1.to_z = 3;

        Anim anim2 = new Anim ();

        anim2.from_x = 0;
        anim2.from_y = 0;
        anim2.from_z = 2;
        anim2.to_x = 0;
        anim2.to_y = 0;
        anim2.to_z = 3;

        animList = new Anim[2] {anim1, anim2};
    }
예제 #45
0
파일: UI.cs 프로젝트: Cabriter/DotaLegend
 void Start()
 {
     ac = gameObject.GetComponent<Anim>();
     ac.PlayAnimationLoop(animation);
     transform.localPosition = worldPos;
 }
예제 #46
0
파일: Sprite.cs 프로젝트: nezek6/Wizardry
 public virtual void SetCurrentAnimation( Anim animation )
 {
     currentAnim = animation;
     currentAnimation = Animations[animation];
 }