u`
EyQ[ҁzp.136uQ[Ŏgp摜pӂv
Ey@ҁzfloatAtB[hϐA\ Ȃ

yQ[ҁzp.136uQ[Ŏgp摜pӂv

p.136 AssetstH_ɉ摜p̃tH_쐬

E@[Create]ˁu{v

p.137 摜t@C荞

E@̉摜t@ĆugameimagevtH_

p.139 vC[LN^[o

E@[Create]ˁu{v
EA[2D Object][Sprite][2D Object][Sprites][Square]
EB̖O̕ύX́A߂Ă܂ƂAp.140ǍŃgCƗǂ

p.141 XNvggShooter𓮂

E@̑OInspctor̖OuShootervɂȂĂ邱ƂmF܂͓
E@ŁuShootervƓ͂ucvŁuEdit Scriptv

p.142 Shooter.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shooter : MonoBehaviour {
    float move = 0.05f; //PxϐĈړPʂƂ
    void Update() { //t[\ƂɎs
        Vector3 pos = transform.position; //ʒu𓾂
        pos.x += move; //XWɈړPʂ𑫂(Eړ)
        transform.position = pos; //ʒuɏ߂(ۂɈړ)
    }
}

y@ҁzp.142 float

Ep.056̂ƂA\Iȑgݍ݌^̈ŁAPx(_̂l)p̃f[^^
Eʏ̃vOł́Ap̌^ƂĎsČ덷Ȃdouble^
EAfloat^̓ʂŁAʂ̎UnityB
E܂A\ɂW͐{Ȃ̂ŁAx̍͂قǕKvƂȂB
EvOɃf[^Lq̂eƂA_͎e
Ee̗F -3.14A1234567989.0
Eě^double^Ȃ̂ŁAfloat^̕ϐɑAlƂƐx邽߃G[ɂȂ
E邽߂ɁAefloat^ɂ邱Ƃufv܂́uFvڔƂĎw肷邱

y@ҁzp.142 tB[hϐ

ENXŃ\bh̊Oɒ`ϐȂǂtB[hϐ(f[^o)Ƃ
EȂApubNϐ(p.052)tB[hϐ̈
Eʏ̃\bhŒ`Ăϐ̓[JϐƂA\bh̒ł̂ݗLŁA\bhIƔjĂ܂
EtB[hϐ̓vOI܂ŗLAmۂĂ܂̂ŁA̕KvȂ΃̖ʂɂȂ̂ŒӁB
ȄꍇAUpdate\bhxUnityĂяoA̒ŗpϐȂ̂ŁAtB[hϐɂǂ

y@ҁzp.144 & 168 \

ECȂǂ̍\͕̂ϐ܂Ƃ߂̂ŁAႦ΁AWƂ\̂̒XWYWuB
EC#̍\̂͂̏ʃo[WŌyʃNXɂȂĂ
EUnitył3WSVector3\(p.144)Ȃǂ񋟂Ă
ENXƂ̍ł傫ȈႢ͌płȂƁAl^(f[^̂̂`)ȂƁB

y@ҁzp.144 Vector3\

Ehttps://docs.unity3d.com/ja/2021.2/ScriptReference/Vector3.htm
Eustruct in UnityEnginevƂʂA\̂Łuusing UnityEngine;vɂ藘p\
EVevtor3\̂^Ƃϐpos`āiVector3 posjʒuĂB
EMonoBehaviourNXɂtransformIuWFNg(R|[lg)̂ŁAMonoBehaviourNXpShooterNXɈpĂ
EtransformIuWFNg(Unityɂ)TransformNX琶ꂽoȂ̂ŗp\
Ehttps://docs.unity3d.com/ja/2021.2/ScriptReference/Transform.html
ETransformNXɂpositionvpeB܂܂Ă̂ŗp\łA݂̍W񂪓\ɂȂĂ
EpositionvpeBVevtor3\̂^ƂĂ̂ŁAVevtor3\̌^posɑł
@i܂AvpeBgetɂVevtor3\̌^̃IuWFNgԂj
EȂAVevtor3̒ɁAXWϐxuIuWFNg.xvŗpł
EāAɁupos.xvƂ邱ƂxW
Eϐxfloat^Ȃ̂ŁAZ邽߂̃tB[hϐmovefloat^ɂƗǂ

AWKFp.142 Shooter.cs

EStart\bh𕜊ĉLLAmF悤
@@ transformIuWFNgpositionvpeBœVector3IuWFNgϐposɑ
@A posDebug.Logŕ\Ɓi0.00, 4.00, 0.00jƂȂB
@ IɁupos.ToString()vĂ΂ĕҏWu(XW, YW, ZW)vo͂

쐬

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shooter : MonoBehaviour {
    float move = 0.05f; //PxϐĈړPʂƂ
    void Update() { //t[\ƂɎs
        Vector3 pos = transform.position; //ʒu𓾂
        pos.x += move; //XWɈړPʂ𑫂(Eړ)
        transform.position = pos; //ʒuɏ߂(ۂɈړ)
    }
    void Start() { //yȉǉzN̂ݎs
        Vector3 work = transform.position; //ʒu𓾂
        Debug.Log(work);
    }
}

p.145 TransformNXtransformvpeB

ETransformNX^̃vpeBŁAget̂ݒ`Ă(ǂݍݐp)
E̍ӂȂǂɒuƃvpeBget̓esATransformNX^IuWFNg
EǂݍݐpȂ̂Łutransform = null;vȂǂ̓G[ɂȂ
@ vpeB̍ӂɏƃvpeBsetĂ΂
@ vpeB̍ӈȊOɏƃvpeBgetĂ΂

p.146 Shooter.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shooter : MonoBehaviour {
    float move = 0.05f; //PxϐĈړPʂƂ
    void Update() { //t[\ƂɎs
        Vector3 pos = transform.position; //ʒu𓾂
        pos.x += move; //XWɈړPʂ𑫂(Eړ)
        if (pos.x < -2.5f) { //[ɒBH
            move = 0.05f; //ړPʂ𐳂(͉Eړ)
        }
        if (pos.x > 2.5f) { //E[ɒBH
            move = -0.05f; //ړPʂ𕉂(͍ړ)
        }
        transform.position = pos; //ʒuɏ߂(ۂɈړ)
    }
    void Start() { //N̂ݎs
    }
}

~jKFShooter.cs

Shooter.csȂǂɃRs[USBɕۑAǨɖ߂悤ɂĂ
EShooterE΂߉ɓAǂŔ˂悤ɂ悤
EmovemovexmoveyɂƗǂ
EE[A[ɗmovex̕𔽓]Ηǂ(0.05-0.05)
E[A[ɗmovey̕𔽓]Ηǂ(0.05-0.05)

oF~jKFShooter.cs

\Fp.148uRigidBody2DR|[lgv
