コード例 #1
0
ファイル: Road.cs プロジェクト: eiseneker/gun-dueler
    // Use this for initialization
    void Start()
    {
        loadMarker      = transform.Find("LoadMarker").GetComponent <LoadMarker>();
        loadMarker.road = this;
        roads.Add(this);
//		transform.eulerAngles = new Vector3(
//			1,
//			transform.eulerAngles.y,
//			transform.eulerAngles.z);
        if (GameController.gameStarted)
        {
            foreach (Transform child in transform.Find("Spawns"))
            {
                float randomValue = Random.value;

                if (randomValue <= hazardChance)
                {
                    GameObject rock = Instantiate(Resources.Load("Rock"), SpawnPosition(child.transform.position), Quaternion.identity) as GameObject;
                    rock.transform.localScale = rock.transform.localScale * .1f;
                }
                else if (randomValue <= hazardChance + neutralChance)
                {
                    GameObject neutralContainer = Instantiate(Resources.Load("Minions/Neutral Container"), SpawnPosition(child.transform.position), Quaternion.identity) as GameObject;
                    Transform  neutralBody      = neutralContainer.transform.Find("Ship").transform;
                    neutralBody.GetComponent <Entity>().neutral = true;
                    OrientationHelper.RotateTransform(neutralBody.transform, -90);
                }
            }
        }
    }
コード例 #2
0
    public override void Start()
    {
        base.Start();
        driveBehavior = DriveBehavior.None;

        vehicleControls = GetComponent <VehicleControls>();
        turretTransform = transform.Find("Turret");
        turret          = turretTransform.GetComponent <SheepTurret>();
        turret.owner    = gameObject;
        myRigidBody     = GetComponent <Rigidbody2D>();
        if (reversePosition)
        {
            reverseFactor *= -1;
        }
        acceleration = Random.value;

        if (reversePosition)
        {
            OrientationHelper.RotateTransform(turretTransform, 180);
        }
        foreach (Transform child in transform.Find("Body").transform)
        {
            CarWheel wheel = child.GetComponent <CarWheel>();
            if (wheel)
            {
                wheel.vehicleControls = vehicleControls;
            }
        }
    }
コード例 #3
0
ファイル: Vulcan.cs プロジェクト: eiseneker/gun-dueler
 protected override void Update()
 {
     base.Update();
     OrientationHelper.RotateTransform(transform, currentAngle, 1);
 }
コード例 #4
0
 public void RotateMe(float degrees)
 {
     OrientationHelper.RotateTransform(transform, degrees);
 }