示例#1
0
    public virtual void Start()
    {
        //Resources.LoadAll("",  typeof(Sprite));
        render         = GetComponent <SpriteRenderer>();
        m_fcurrentTime = 0;
        //Init pivot Move
        IAnimations.InitPivot(ref sprites_Move, floatRight);
        ////Init pivot Stand
        IAnimations.InitPivot(ref sprites_Stand, floatRight);
        ////Init pivot Hit
        IAnimations.InitPivot(ref sprites_Hit, floatRight);
        //Init Die
        IAnimations.InitPivot(ref sprites_Die, floatRight);

        InitCollider();
        m_rigidBody             = this.gameObject.AddComponent <Rigidbody2D>();
        m_rigidBody.constraints = RigidbodyConstraints2D.FreezeRotation;

        //Init Time move
        m_fMaxTimeMove  = UnityEngine.Random.Range(2f, 4f);
        m_fMaxTimeStand = UnityEngine.Random.Range(1f, 3f);

        //Flip
        if (!m_isFacingRight)
        {
            render.flipX = true;
        }

        //Set event die
        m_attribute.OnDieTrigger += OnDieTrigger;
    }
 public override void Start()
 {
     base.Start();
     IAnimations.InitPivot(ref sprites_Skill_1, floatRight);
     IAnimations.InitPivot(ref sprites_Skill_2, floatRight);
     m_CurrentSkill = sprites_Skill_1;
     target_Move    = Vector2.zero;
     target_Move    = new Vector2(Random.Range((int)m_LstMove[0].position.x, (int)m_LstMove[1].position.x), m_LstMove[0].position.y);
     m_stages       = Stages.Stand;
 }