private void Start() { planetTransform = new PlanetSurfaceTransform( Planet.instance ); planetTransform.SetHeight( _startingHeight ); planetTransform.SetPosition( transform ); }
private void Start() { _planet = FindObjectOfType<Planet>(); planetTransform = new PlanetSurfaceTransform( _planet ); _reactCalc = new Expressions.ReactiveCalculator (activation); _reactCalc.SubscribeProperty( "dangerLevel", GameplayController.instance.dangerLevel ); _reactCalcDeact = new Expressions.ReactiveCalculator (deactivation); _reactCalcDeact.SubscribeProperty( "dangerLevel", GameplayController.instance.dangerLevel ); planetTransform.Move (transform, spawnMoveVector, 10.0f); SpawnThisEnemyNow11111 (); }
public void Launch( Character owner, Vector3 direction, float speed, int damage ) { this.owner = owner; this.speed = speed; this.direction = direction; this.damage = damage; _planetTransform = new PlanetSurfaceTransform( Planet.instance ); _planetTransform.SetHeight( owner.pawn.planetTransform.height ); transform.position = this.owner.pawn.position; transform.rotation = this.owner.pawn.rotation; timer = new AutoTimer( lifetime ); enabled = true; }
public Vector3 GetDirectionTo( PlanetSurfaceTransform otherTransform ) { var relativePosition = ( otherTransform.rotation ) * Vector3.up * _planet.radius - rotation * Vector3.up * ( _planet.radius ); //var result = new Vector3( relativeRotation.eulerAngles.z, 0, relativeRotation.eulerAngles.y ); var result = Quaternion.Inverse( rotation ) * relativePosition; result.y = ( otherTransform.height ) - height; //result.y = ( ( destination - _planet.transform.transform ).magnitude - _planet.radius ) - height; return result.normalized; //var result = Quaternion.Inverse( rotation ) * ( otherTransform.rotation ) * Vector3.up; //result.y = otherTransform.height - height; //return result.normalized; }
protected override void Start() { base.Start(); planetTransform = new PlanetSurfaceTransform( Planet.instance ); planetTransform.SetHeight( _startingHeight ); planetTransform.SetPosition( transform ); }
public void MoveTowards( Transform transform, PlanetSurfaceTransform otherTransform, float speed ) { Move( transform, GetDirectionTo( otherTransform ), speed ); }