예제 #1
0
    public override void Initialize()
    {
        base.Initialize();

        originTransform = transform.position;
        originx         = transform.position.x;
        leftx           = originx - 4f;
        rightx          = originx + 4f;

        //player = GameObject.Find("Player");

        enemyAnim        = GetComponent <Animator>();
        rb               = GetComponent <Rigidbody2D>();
        coll             = GetComponent <CapsuleCollider2D>();
        defenceComponent = GetComponent <DefenceEnemies>();
        if (transform.localScale.x > 0)
        {
            faceRight = true;
        }
        else
        {
            faceRight = false;
        }
        //初始化速度
        speed           = 1f;
        seekSpeed       = 2f;
        originSpeed     = speed;
        originSeekSpeed = seekSpeed;
        toRightVelocity = new Vector2(speed, jumpForce);
        toLeftVelocity  = new Vector2(-speed, jumpForce);

        //脚下检测点偏移量
        leftV  = new Vector2(-0.3f, -0.55f);
        rightV = new Vector2(0.3f, -0.55f);
    }
예제 #2
0
    //public SharedFloat lastAttackedTime;
    public override void OnStart()
    {
        base.OnStart();

        //slimerAnim = GetComponent<Animator>();
        defenceComponent  = GetComponent <DefenceEnemies>();
        movementComponent = GetComponent <MovementEnemies>();
    }
예제 #3
0
    public override void Initialize()
    {
        base.Initialize();

        originTransform = transform.position;
        originx         = transform.position.x;
        leftx           = originx - 4f;
        rightx          = originx + 4f;

        //player = GameObject.Find("Player");

        enemyAnim        = GetComponent <Animator>();
        rb               = GetComponent <Rigidbody2D>();
        dashColl         = GameObject.Find("DashColl").GetComponent <Collider2D>();
        dashColl.enabled = false;
        attackComponent  = GetComponent <AttackEnemies>();
        defenceComponent = GetComponent <DefenceEnemies>();

        //确定朝向
        if (transform.localScale.x > 0)
        {
            faceRight = true;
        }
        else
        {
            faceRight = false;
        }
        //初始化速度
        speed           = 2f;
        seekSpeed       = 3f;
        originSpeed     = speed;
        originSeekSpeed = seekSpeed;
        toRightVelocity = new Vector2(speed, jumpForce);
        toLeftVelocity  = new Vector2(-speed, jumpForce);

        //脚下检测点偏移量
        leftV  = new Vector2(0f, -2.1f);
        rightV = new Vector2(2f, -2.1f);

        //boss无法被轻易眩晕
        isUnStoppable = true;
        //疲劳状态CD
        statusCD = 5f;
    }
예제 #4
0
 public override void OnStart()
 {
     base.OnStart();
     defenceComponent = GetComponent <DefenceEnemies>();
     attackComponent  = GetComponent <AttackEnemies>();
 }