コード例 #1
0
ファイル: EnemyAI.cs プロジェクト: CasperLC/2D-GameJAM
 // Start is called before the first frame update
 void Start()
 {
     rb2d               = GetComponent <Rigidbody2D>();
     enemyAggro         = aggroCollider.GetComponent <EnemyAggro>();
     rightChecker       = sideCheckerRight.GetComponent <SideCheckerRight>();
     leftChecker        = sideCheckerLeft.GetComponent <SideCheckerLeft>();
     groundChecker      = groundCheckBox.GetComponent <GroundChecker>();
     avoidPlayerChecker = avoidPlayerCapsule.GetComponent <EnemyAvoidPlayerBlock>();
     thisEnemy          = enemy.GetComponent <Enemy>();
     enemyRange         = attackPoint.GetComponent <EnemyRangeCheck>();
 }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        animator       = GetComponent <Animator>();
        rb2d           = GetComponent <Rigidbody2D>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        groundChecker  = groundCheckBox.GetComponent <GroundChecker>();
        rightChecker   = rightCheckerBox.GetComponent <SideCheckerRight>();
        leftChecker    = leftCheckerBox.GetComponent <SideCheckerLeft>();

        currentHealth = maxHealth;
        SetHealth(currentHealth, maxHealth);

        lastPos = rb2d.velocity;
    }