示例#1
0
        public Hazard(Vector3 position, float speed, bool alive, bool barrelRollin, float rollRandomMod)
        {
            this.position      = position;
            this.world         = Matrix.CreateTranslation(position);
            this.speed         = speed;
            this.alive         = alive;
            this.yaw           = 0;
            this.pitch         = 0;
            this.roll          = 0;
            this.barrelRollin  = barrelRollin;
            this.rollRandomMod = rollRandomMod;
            this.explosionSize = 0.5f;
            this.observers     = new List <Observer>();
            this.scoreObserver = new ScoreObserver();
            AddObserver(scoreObserver);

            velocity     = Vector3.Forward;
            defaultSpeed = new Vector3(0, 0, speed);

            foreach (ModelMesh mesh in HazardForm.Model.Meshes)
            {
                boundingSphere = BoundingSphere.CreateMerged(this.boundingSphere, mesh.BoundingSphere);
            }

            boundingSphere.Radius *= HazardForm.scale;
        }
示例#2
0
 // Use this for initialization
 void Start()
 {
     // get the initial position of the game object
     playerPosition = gameObject.transform.position;
     scoreKeeper    = new ScoreObserver();
     lifeMaintain   = new lifeconcereteobserver();
 }
 void PlayerAwake()
 {
     input  = new InputManager();
     hotbar = new PlayerInventory(defaultIcon, selectedIcon, emptyItem, SlotNumber);
     MyCamera.SetActive(false);
     MyFBOCam.SetActive(false);
     ThisPlayer   = new Player(gameObject, head, hotbar, false, input, HandTarget);
     Player1Stats = new StatObserver(ThisPlayer);
     Player1Score = new ScoreObserver(ThisPlayer);
     /*FOR TUTORIAL:*/ //Player1.SetState(new TeachWalkState());
     /*FOR EDITING:*/ ThisPlayer.SetState(new TeachPickupState());
 }
示例#4
0
 public Hazard(float rollRandomMod)
 {
     this.position      = Vector3.Zero;
     this.world         = Matrix.CreateTranslation(position);
     this.speed         = 0;
     this.yaw           = 0;
     this.pitch         = 0;
     this.roll          = 0;
     this.alive         = false;
     this.barrelRollin  = false;
     this.rollRandomMod = rollRandomMod;
     this.explosionSize = 0.5f;
     this.observers     = new List <Observer>();
     this.scoreObserver = new ScoreObserver();
     AddObserver(scoreObserver);
 }
示例#5
0
 public Hazard() //para usar c generics pq n deixa usar construtor com parametros la dentro...
 {
     this.position      = Vector3.Zero;
     this.world         = Matrix.CreateTranslation(position);
     this.speed         = 0;
     this.yaw           = 0;
     this.pitch         = 0;
     this.roll          = 0;
     this.alive         = false;
     this.barrelRollin  = false;
     this.rollRandomMod = 1;
     this.explosionSize = 0.5f;
     this.observers     = new List <Observer>();
     this.scoreObserver = new ScoreObserver();
     AddObserver(scoreObserver);
 }
示例#6
0
    /// <summary>
    /// Method called when the local player was stated.
    /// </summary>
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();

        CmdInit(PlayerBehaviour.instance.localPlayer._id);

        GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GameCameraBehaviour> ().SetTarget(transform);

        GameObject obj = GameObject.FindGameObjectWithTag("GameScene");

        if (obj != null)
        {
            _scoreObserver = obj.GetComponentInChildren <ScoreObserver> ();

            WarningBehaviour wb = obj.GetComponentInChildren <WarningBehaviour> ();
            wb._delegate             = OnCollisionEnter;
            _outOfCombatAreaObserver = wb;

            _deadObserver = obj.GetComponent <DeadObserver> ();

            obj.GetComponent <GameSceneBehaviour> ()._observer = this;
        }
    }
示例#7
0
	// Use this for initialization
	void Start () {
		// get the initial position of the game object
		playerPosition = gameObject.transform.position;
		scoreKeeper = new ScoreObserver ();
		lifeMaintain = new lifeconcereteobserver (); 
	}