Inheritance: MonoBehaviour
Exemplo n.º 1
0
	/**
	 * Runs at load time
	 */
	void Start () {
		movementController = MovementController.S;
		resourceTileController = ResourceTileController.S;
		tilesController = TilesController.S;


	}
 // Use this for initialization
 void Start()
 {
     text = ui.GetComponent<Text> ();
     mControl = GetComponent<MovementController> ();
     charClass = GetComponent<CharacterClass> ();
     netview = mControl.netView;
 }
Exemplo n.º 3
0
    public void PickUp(Transform player)
    {
        if (!isHeld) {
            playerHolding 	= player;
            acCont   		= playerHolding.GetComponent<ActionController> ();
            moveCont 		= playerHolding.GetComponent<MovementController> ();

            if (acCont.canHoldWeapon) {
                isHeld 				 = true;
                acCont.canHoldWeapon = false;
                acCont.holdingWeapon = true;
                transform.parent 	 = playerHolding.transform;
                transform.position 	 = acCont.weaponHoldPosition.position;

                if (inSpawner) {
                    spawner.GetComponent<WeaponSpawner> ().WeaponTaken ();
                    inSpawner = false;
                }

                if (facingRight && !moveCont.facingRight ||	!facingRight && moveCont.facingRight) {
                    Flip ();
                }

                if (GetComponent<PolygonCollider2D> () != null) {
                    GetComponent<PolygonCollider2D> ().enabled = false;
                } else {
                    GetComponent<BoxCollider2D> ().enabled = false;
                }
            }
        }
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start () {
		body = gameObject.GetComponent<Rigidbody>();
        boxcollider = gameObject.GetComponent<BoxCollider>();
        defaultBoxColliderSize = boxcollider.size;
        defaultPlayerSize = body.transform.localScale;
        defaultFPVCameraAngle = CameraController.S.cameras[(int)CameraType.fpv].transform.localRotation;
        player = this;
	}
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RovioAPI" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public RovioAPI(string host, int port, NetworkCredential credentials)
        {
            this.rwc = new RovioWebClient(host, port, credentials);

            this.movement = new MovementController(this);
            this.manualDriver = this.movement.ManualDriver;
            this.camera = new CameraController(this);
        }
Exemplo n.º 6
0
	// Use this for initialization
	void Start () {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
        moveScript = player.gameObject.GetComponent<MovementController>();
        splineScript = splineScript.GetComponent<SplineController>();
	    if(WaypointList.Count > 2) //just to prevent the thing from giving null ref error if the list is too small
        {
            lastWayPoint = WaypointList.Count - 1;
        }
	}
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        GameObject p = GameObject.FindGameObjectWithTag("Player");
        mCtrl = p.GetComponent<MovementController>();
        aCtrl = p.GetComponent<AttackController>();
        eCtrl = p.GetComponent<EquipmentController>();

        game = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
    }
Exemplo n.º 8
0
 public virtual void Start()
 {
     textbox.enabled = false;
     dialogs.enabled = false;
     characterpic.enabled = false;
     showname.enabled = false;
     _mScript = GameObject.FindGameObjectWithTag("Player").GetComponent<MovementController>();
     charanim = GameObject.Find("Character").GetComponent<Animator>();
     serikAnim = GameObject.FindGameObjectWithTag("SerikGhost").GetComponent<Animator>();
 }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        curmctrl = GameObject.FindGameObjectWithTag ("Player").GetComponent<MovementController> ();
        curslider = GetComponent<Slider> ();

        // Retrieve speed from MovementController
        speed = curmctrl.speed;

        StartCoroutine (Ongoing ());
    }
 void Start()
 {
     netView = GetComponent<NetworkView>();
     mControl = player.GetComponent<MovementController> ();
     if (netView.isMine) {
         mControl.cam.enabled = true;
     }
     if (!netView.isMine) {
         mControl.cam.enabled = false;
     }
 }
Exemplo n.º 11
0
	// Use this for initialization
	protected virtual void Start () 
	{
		player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
		_rbAI = GetComponent<Rigidbody>();
		_waypoint = areaCenter + (OnUnitRect(rectSize.x,rectSize.z)) * rectMagnitude;
		playerMana = GameObject.FindGameObjectWithTag("Player").GetComponent<MovementController>();
        spawnPoint = transform.position;
        possessExplode = GameObject.Find("SpiritBomb");
        gamecontroller = GameObject.Find("GameControlCenter").GetComponent<GameControl>();
        possanim = possessExplode.GetComponent<Animator>();
	}
Exemplo n.º 12
0
   // protected abstract void AggroAbility();
	// Use this for initialization
    protected virtual void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
		playerMana = GameObject.FindGameObjectWithTag("Player").GetComponent<MovementController>();
        agent = gameObject.GetComponent<NavMeshAgent>();
        origin = gameObject.transform.position;
		waitTimer = 0.0f;
		circleCenter = transform.position + new Vector3(0, 0, offset);
		currentTargetPosition = transform.position;
        possessedexplode = GameObject.Find("SpiritBomb");
        possanim = possessedexplode.GetComponent<Animator>();
    }
Exemplo n.º 13
0
	/**
	 * Runs at load time
	 */
	void Start () {
		disabledTileController = DisabledTileController.S;
		gameController = GameController.S;
		highlightsController = HighlightsController.S;
		mapsController = MapsController.S;
		movementController = MovementController.S;
		playerController = PlayerController.S;
		resourceTileController = ResourceTileController.S;
		remoteCamera = RemoteCamera.S;
		tilesController = TilesController.S;
		unitsController = UnitsController.S;
	}
Exemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     //_charCam.SetActive(false);
     CamPanScript = GameObject.FindGameObjectWithTag("Camera").GetComponent<CameraPanning>();
     _dScript = GameObject.FindGameObjectWithTag("GulnazBody").GetComponent<DialogueScript>();
     _camChar.GetComponent<Camera>();
     _movieCam.GetComponent<Camera>();
     _camChar.enabled = false;
     deshControl = GameObject.FindGameObjectWithTag("desh").GetComponent<Animator>();
     _desh = GameObject.FindGameObjectWithTag("desh").GetComponent<NavMeshAgent>();
     _moveScript = GameObject.FindGameObjectWithTag("Player").GetComponent<MovementController>();
     _dTutScript = GameObject.FindGameObjectWithTag("desh").GetComponent<DeshTutorial>();
     _Gulnaz = GameObject.FindGameObjectWithTag("Player");
 }
Exemplo n.º 15
0
	/**
	 * Runs at load time
	 */
	void Start () {
		gameController = GameController.S;
		mapsController = MapsController.S;
		movementController = MovementController.S;
		playerController = PlayerController.S;
		remoteCamera = RemoteCamera.S;

		unitTypesCollection = UnitTypes.S;

		playerUnitCounts = new Dictionary<string, int>[4];

		// Copy the settings from the parent unit types to the faction units
		propagateOptions ();
	}
Exemplo n.º 16
0
	public void Init()
	{
		if (!isLocalPlayer)
		{
			Object.Destroy(mainCamera.gameObject);
		}
		else
		{
			terrainCollider = GetComponentInParent<TerrainCollider>();
			bulletsEmiter = GetComponentInChildren<BulletsEmiter>();
			towerController = GetComponentInChildren<TowerController>();
			movementController = GetComponentInChildren<MovementController>();
		}
	}
Exemplo n.º 17
0
	/**
	 * Runs at load time
	 */
	void Start () {
		battleController = BattleController.S;
		disabledTileController = DisabledTileController.S;
		gameController = GameController.S;
		highlightsController = HighlightsController.S;
		mapsController = MapsController.S;
		movementController = MovementController.S;
		navController = NavController.S;
		playerController = PlayerController.S;
		resourceTileController = ResourceTileController.S;
		tilesController = TilesController.S;
		turnsController = TurnsController.S;
		unitsController = UnitsController.S;
	}
    void Awake()
    {
        if (instance)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }

        Debug.Log("MovementController: Resetting MovementSpeed...");

        // Reset the movement speed
        ChangeSpeed();
    }
Exemplo n.º 19
0
    private void Start()
    {
        _inventory = GetComponent<Inventory>();
        _scrollingText = GetComponent<ScrollingText>();
        _animator = GetComponent<Animator>();
        _movementController = GetComponent<MovementController>();

        _compass = transform.Find("Compass");
        _characterController = GetComponent<CharacterController>();

        switch (Job)
        {
            case Job.None: return; // Do nothing
            case Job.WoodCutter: _jobTask = WorkTask.ChopWood; break;
            case Job.Miner: _jobTask = WorkTask.Mine; break;
        }
        _currentTask = _jobTask;
    }
Exemplo n.º 20
0
    public void Drop()
    {
        if (isHeld) {
            if(GetComponent<PolygonCollider2D> () != null){
                GetComponent<PolygonCollider2D> ().enabled = true;
            } else {
                GetComponent<BoxCollider2D> ().enabled = true;
            }

            transform.rotation 	 = Quaternion.identity;
            facingRight 	 	 = moveCont.facingRight;
            acCont.holdingWeapon = false;
            playerHolding 		 = null;
            acCont 				 = null;
            moveCont 			 = null;
            isHeld 			 	 = false;
            transform.parent 	 = null;
        }
    }
Exemplo n.º 21
0
	// Use this for initialization
	void Awake()
	{
		movementFSM = gameObject.AddComponent<MovementController>();

		if (!(jetpack3DMovement = GetComponent<Jetpack3DMovement>()))
			jetpack3DMovement = gameObject.AddComponent<Jetpack3DMovement>();

		if (!(sphericalMovement = GetComponent<SphericalMovement>()))
			sphericalMovement = gameObject.AddComponent<SphericalMovement>();

		switch(movementScheme)
		{
			case Movement.JETPACK3D:
				movementFSM.Configure(this, jetpack3DMovement);
				break;
			case Movement.SPHERICAL:
				movementFSM.Configure(this, sphericalMovement);
				break;
		}
	}
Exemplo n.º 22
0
    private void Start()
    {
        rb = GetComponent <Rigidbody>();
        mv = GetComponent <MovementController>();

        Energy               = maxEnergy;
        Hydration            = maxHydration;
        Alive                = true;
        TimeAlive            = 0;
        AccumEnergy          = 0;
        AccumHydration       = 0;
        overlappedWaterTiles = new List <Water>();

        // Create attribute bars
        attributeBars = null;
        if (showAttributeBars)
        {
            attributeBars = Instantiate(attributeBarsPrefab, Vector3.zero, Quaternion.identity, GameObject.FindGameObjectWithTag("Canvas").transform);
            attributeBars.followTransform = transform;
            attributeBars.SetMaxEnergy(maxEnergy);
            attributeBars.SetMaxHydration(maxHydration);
        }
    }
Exemplo n.º 23
0
    void Start()
    {
        chargingParticleSystem.SetActive(false);

        chakupiState = ChakupiState.Moving;

        character = GetComponent <Character>();
        character.CharacterInjuredEvent.AddListener(GetHit);

        detector.GetComponent <PlayerDetector>().playerDetectedEvent.AddListener(DetectPlayer);

        characterAnimator  = GetComponent <ChakupiCharacterAnimator>();
        movementController = GetComponent <MovementController>();

        if (facingDirection)
        {
            characterAnimator.faceRight();
        }
        else
        {
            characterAnimator.faceLeft();
        }
    }
Exemplo n.º 24
0
    // Start is called before the first frame update
    void Awake()
    {
        gridLayout                = GameObject.Find("Grid").GetComponent <GridLayout>(); //Access and store the GridLayout component
        enemyCellPosition         = gridLayout.WorldToCell(transform.position);          //Get this enemy's cell position and convert it to the nearest hex coordinates. This is the first half of an operation to center this object in it's position in the hex grid
        transform.position        = gridLayout.CellToWorld(enemyCellPosition);           //Take the hex grid position from the last operation, convert it back to world coordinates and set this object's position to those coordinates
        player                    = GameObject.FindGameObjectWithTag("Player");          //Access and store the player game object
        movementController        = player.GetComponent <MovementController>();
        gameController            = GameObject.Find("GameController");
        abilityController         = player.GetComponent <AbilityController>();    //Access and store the ability controller
        highlightEnabled          = false;
        mapManager                = gameController.GetComponent <ManageMap>();    //Access and store a reference to the map manager script
        clickManager              = gameController.GetComponent <ClickManager>(); //Access and store a reference to the click manager script
        resourceAndUpgradeManager = gameController.GetComponent <ResourceAndUpgradeManager>();
        tutorialManager           = gameController.GetComponent <TutorialManager>();
        playerHealthControl       = player.GetComponent <PlayerHealthControl>();
        shotIncoming              = false; //Set the initial state of the laser animation
        string clone = "(Clone)";

        thisEnemyName = gameObject.name;
        thisEnemyName = thisEnemyName.Replace(clone, "");
        inFlats       = false;
        //thisEnemyObject = new EnemyObject(enemyCellPosition.x, enemyCellPosition.y, thisEnemyName);
    }
Exemplo n.º 25
0
 private void Awake()
 {
     if (!mController)
     {
         mController = GetComponent <MovementController>();
     }
     if (!sController)
     {
         sController = GetComponent <SlideScript>();
     }
     if (!cController)
     {
         cController = GetComponent <CrouchScript>();
     }
     if (!gController)
     {
         gController = GetComponent <GlideScript>();
     }
     if (!fController)
     {
         fController = GetComponent <FlyScript>();
     }
 }
        void Awake()
        {
            ragdollController = GetComponent <RagdollController>();

            characterMovement = GetComponent <CharacterMovement>();

            movementController = GetComponent <MovementController>();

            humanoidAim = GetComponent <Game.Combat.HumanoidAim>();



            if (cameraScript != null)
            {
                originalCamScriptTarget = cameraScript.m_Target;
                originalUpdateMode      = cameraScript.updateMode;
            }

            SubscribeToEvents();


            ragdollRightHand = ragdollController.ragdoll.GetBone(HumanBodyBones.RightLowerArm).transform.GetChild(0);
        }
Exemplo n.º 27
0
    private void Start()
    {
        movementController       = GetComponentInParent <MovementController>();
        parentAnimator           = GetComponentInParent <Animator>();
        parentAnimatorController = GetComponentInParent <AnimatorController>();
        player   = GetComponentInParent <Controller2D>();
        cooldown = GetComponent <Cooldown>();

        playerColliderExtentX = player.collider.bounds.extents.x;

        animationClips = parentAnimator.runtimeAnimatorController.animationClips;
        for (int i = 0; i < animationClips.Length; i++)
        {
            if (animationClips[i].name == "Player_Teleport_Out")
            {
                teleportOutClipLength = animationClips[i].length;
            }
            if (animationClips[i].name == "Player_Teleport_In")
            {
                teleportInClipLength = animationClips[i].length;
            }
        }
    }
Exemplo n.º 28
0
        /// <inheritdoc />
        protected override Behavior.Status UpdateInternal()
        {
            //Lost target.
            if (!Targeter.HasTarget)
            {
                return(BehaviorTree.Behavior.Status.Failure);
            }

            //Check if close enough.
            float distance = Targeter.DistanceToTarget();

            if (distance < _targetReachedDistance)
            {
                return(BehaviorTree.Behavior.Status.Success);
            }

            //Move towards target.
            Vector3 direction = Targeter.DirectionToTarget();

            MovementController.ApplyMovement(direction);

            return(BehaviorTree.Behavior.Status.Running);
        }
Exemplo n.º 29
0
        protected override void LoadContent()
        {
            _viewportAdapter = new ScalingViewportAdapter(_graphics.GraphicsDevice, 1600, 900);

            _camera      = new OrthographicCamera(_viewportAdapter);
            _spriteBatch = new SpriteBatch(_graphics.GraphicsDevice);

            if (File.Exists(@"Content\allSprites_default.xml"))
            {
                _atlas             = TextureAtlasData.CreateFromFile(Content, @"Content\allSprites_default.xml");
                _projectileFactory = new ProjectileFactory(_entityManager, _atlas);
            }


            var map = Content.Load <TiledMap>("map01");

            _mapRenderer = new TiledMapRenderer(_graphics.GraphicsDevice);
            LoadMap(map);
            _player = _entityManager.AddEntity(
                new Player(_atlas.GetRegion("tankBody_red"), _atlas.GetRegion("tankRed_barrel1"), _projectileFactory)
                );
            _movementController = new MovementController(_player, _camera);
        }
Exemplo n.º 30
0
    private void Start()
    {
        movementController = GetComponent <MovementController>();
        playerTransform    = GetComponent <Transform>();
        forceApplier       = GetComponent <ForceApplier>();
        playerInput        = GetComponent <PlayerInput>();
        healthBar          = FindObjectOfType <HealthBarController>();
        enemyHPBar         = FindObjectOfType <EnemyHealthBar>();
        enemyWPBar         = FindObjectOfType <EnemyWillPowerBar>();
        concentrationBar   = FindObjectOfType <ConcentrationBarController>();
        concentrationBar.setMaxConcentation(maxConcentration);
        willpowerBar = FindObjectOfType <WillpowerBar>();
        willpowerBar.setMaxWillpower(maxWillPower);
        //willpower = maxWillPower;

        noOfTaps      = 0;
        concentration = maxConcentration;
        canAttack     = true;
        isVulnerable  = true;
        isBlocking    = false;
        health        = maxHealth;
        healthBar.setMaxHealth(maxHealth);
    }
Exemplo n.º 31
0
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* ------------------------------------ SCORERS FUNCTIONS -------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    public bool PlayerIsInRangeOfView(MovementController ctr)
    {
        Vector2      head, direction;
        float        radius, distance;
        RaycastHit2D hit;
        int          viewCount, castLayerMask;

        head      = ctr.transform.position + Vector3.up * (1.5f);
        viewCount = Physics2D.OverlapCircleNonAlloc(head, ctr.entity.rangeOfView, this.overlapResults, this.playerLayerMask);

        if (viewCount == 0)
        {
            return(false);
        }

        direction     = ((Vector2)(player.position + player.up * 0.5f)) - head;
        radius        = 0.25f;
        distance      = ctr.entity.rangeOfView;
        castLayerMask = (1 << LayerMask.NameToLayer("Ground")) | this.playerLayerMask;
        hit           = Physics2D.CircleCast(head, radius, direction, distance, castLayerMask);

        return(hit.transform == player);
    }
Exemplo n.º 32
0
    void Start()
    // Verify setup
    {
        Setup();
        // Retry setup if references were cleared post-add

        if (target == null)
        {
            Debug.LogError("No target assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        if (rigidbody == null)
        {
            Debug.LogError("No rigidbody assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        if (jumpBoostVisuals == null)
        {
            Debug.LogError("No jump boost visuals assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        movementController         = GetComponent <MovementController> ();
        movementController.onJump += OnJump;

        target[kRunForwardState].layer              =
            target[kRunBackwardsState].layer        =
                target[kStrafeLeftState].layer      =
                    target[kStrafeRightState].layer = 1;
        target.SyncLayer(1);
        target[kIdleState].layer = 1;
    }
Exemplo n.º 33
0
    // Start is called before the first frame update
    void Start()
    {
        weaponState               = true;
        gameController            = GameObject.Find("GameController");
        gridLayout                = GameObject.Find("Grid").GetComponent <GridLayout>(); //store a reference to the grid layout component
        mapManager                = gameController.GetComponent <ManageMap>();           //store a reference to the map manager
        clickManager              = gameController.GetComponent <ClickManager>();
        uiController              = gameController.GetComponent <UIControl>();
        turnManager               = gameController.GetComponent <TurnManager>();
        resourceAndUpgradeManager = gameController.GetComponent <ResourceAndUpgradeManager>();
        tutorialManager           = gameController.GetComponent <TutorialManager>();
        player = GameObject.FindGameObjectWithTag("Player"); //store a reference to the player game object
        playerHealthControl = player.GetComponent <PlayerHealthControl>();
        movementController  = player.GetComponent <MovementController>();
        maxLaserRange       = resourceAndUpgradeManager.CurrentMaxLaserRange; //set the initial state of the maximum laser range parameter
        maxJumpRange        = resourceAndUpgradeManager.CurrentMaxJumpRange;
        instX = player.transform.position.x;                                  //set the initial x position for instantiated objects
        instY = player.transform.position.y;                                  //set the initial y position for instantiated objects
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);          //get the current position of the mouse pointer

        //target = gridLayout.WorldToCell(ray.origin); //set the initial position of the target (i.e. where is the mouse pointing in grid coordinates)
        target = gridLayout.WorldToCell(clickManager.TouchPosition); //set the initial position of the target (i.e. where is the mouse pointing in grid coordinates)
        //target = gridLayout.WorldToCell(clickManager.ClickPosition); //set the initial position of the target (i.e. where is the mouse pointing in grid coordinates)
        laserState       = false;                                    //set the initial state of the laser ability activation
        jumpState        = false;
        jumpCells        = new List <Vector3Int>();
        rocketRange      = resourceAndUpgradeManager.CurrentMaxRocketRange;
        rocketReloadTime = resourceAndUpgradeManager.CurrentMaxRocketReload;
        playerFlats      = new List <Vector3Int>();
        timer            = 0.0f;
        turnOffAb        = false;
        abilityActive    = false;
        uiController.SetLaserCharge(laserRange, maxLaserRange);
        uiController.SetJumpCharge(jumpRange, maxJumpRange);
        uiController.SetShieldBoostRechargeState(currentShieldBoostCharge, shieldBoostRechargeTime);
        uiController.SetRocketReloadState(currentRocketReloadAmount, rocketReloadTime);
    }
Exemplo n.º 34
0
    private void OnSceneGUI() //Monobehaviour editor function
    {
        MovementController mc = target as MovementController;

        Handles.ArrowHandleCap(0, mc.transform.position, mc.transform.rotation, mc.speed * .3f, EventType.Repaint); //Draws an arrow, at pos in direction of a given size. EventType.Repaint means it happens every frame

        if (mc.waypoints.Length > 1)
        {
            Color originalHandleColor = Handles.color;                                                      //Like Enabled, we must perserve the original handle color!
            Handles.color = Color.green;                                                                    //Set the color of all
            for (int i = 0; i < mc.waypoints.Length - 1; i++)                                               //Length minus one, because the last one doesnt have a "next"
            {
                if (mc.waypoints[i] && mc.waypoints[i + 1])
                {
                    Handles.DrawLine(mc.waypoints[i].position, mc.waypoints[i + 1].position);                   //Draw a line from i to i+1
                }
            }
            if (mc.waypoints[0] && mc.waypoints[mc.waypoints.Length - 1])
            {
                Handles.DrawLine(mc.waypoints[mc.waypoints.Length - 1].position, mc.waypoints[0].position); //Draw line from last element back to first element
            }
            Handles.color = originalHandleColor;                                                            //Reset the handle back to the original!
        }

        Handles.BeginGUI();                                                                                 //Begin 2D gui handle, specifies that this is on the scene
        for (int i = 0; i < mc.waypoints.Length; i++)
        {
            if (!mc.waypoints[i])
            {
                continue;
            }
            Vector2 guiPoint = HandleUtility.WorldToGUIPoint(mc.waypoints[i].position);                     //Convert a space in the world to the 2D GUI space
            Rect    rect     = new Rect(guiPoint.x - 50f, guiPoint.y - 40, 100, 20);                        //Create a scalable rect (In this case, hardcoded size)
            GUI.Box(rect, "Waypoint: " + i);                                                                //Create a GUI text box with the rect size
        }
        Handles.EndGUI();                                                                                   //Call end to GUI 2D Handle
    }
Exemplo n.º 35
0
        public void Paused()
        {
            var npc = Controller.Npc;

            if (npc.Spacemap.Entities.Any(x => x.Value is Player))
            {
                // move around
                if (npc.Range.Entities.Any(x => x.Value is Player))
                {
                    // make a search
                    Player selectedPlayer = null;
                    foreach (var entity in npc.Range.Entities.Where(x => x.Value is Player))
                    {
                        var playerEntity = entity.Value as Player;
                        if (selectedPlayer == null)
                        {
                            selectedPlayer = playerEntity;
                        }
                        else
                        {
                            if (selectedPlayer.Position.DistanceTo(entity.Value.Position) >
                                playerEntity.Position.DistanceTo(npc.Position))
                            {
                                selectedPlayer = playerEntity;
                            }
                        }
                    }

                    npc.Selected = selectedPlayer;
                    MovementController.Move(npc, selectedPlayer.Position);
                }
                else if (!npc.Moving)
                {
                    MovementController.Move(npc, Vector.Random(npc.Spacemap));
                }
            }
        }
Exemplo n.º 36
0
    void Start()
    {
        button = GetComponentInChildren <ButtonMovement>();
        door   = GetComponentInChildren <DoorMovement>();

        tp           = this.transform.GetChild(0).GetChild(5);
        cam_target   = this.transform.GetChild(1);
        reset_target = this.transform.GetChild(4);

        player = GameObject.Find("Playable_Character");
        mc     = player.GetComponent <MovementController>();

        main_camera     = GameObject.Find("MainCamera").GetComponent <Camera>();
        cutscene_camera = GetComponentInChildren <Camera>();

        can      = GameObject.Find("FadeManager");
        cam_fade = can.GetComponent <FadeManager>();

        if (timed_door)
        {
            shape_mat.GetComponent <MeshRenderer>().material = mat[1];
            door_mat.GetComponent <MeshRenderer>().material  = mat[1];
        }
    }
Exemplo n.º 37
0
    private void Start()
    {
        globalVolume.profile.TryGet(out vignette);
        globalVolume.profile.TryGet(out motionBlur);
        globalVolume.profile.TryGet(out filmGrain);
        globalVolume.profile.TryGet(out colorAdjustments);
        globalVolume.profile.TryGet(out chromaticAberration);

        startExposure = colorAdjustments.postExposure.value;
        startContrast = colorAdjustments.contrast.value;

        UIManager.Instance.staminaBar.OnChange += UpdateVignette;
        //UIManager.Instance.staminaBar.OnChange += UpdateMotionBlur;
        UIManager.Instance.staminaBar.OnChange += UpdateFilmGrain;
        UIManager.Instance.staminaBar.OnChange += UpdateChromaticAberration;
        UIManager.Instance.staminaBar.OnChange += UpdateColorGrading;
        UIManager.Instance.staminaBar.OnChange += UpdateCameraDistance;
        UIManager.Instance.staminaBar.OnChange += UpdatePlayerAnimation;
        UIManager.Instance.staminaBar.OnChange += UpdateMovementBuffs;
        UIManager.Instance.staminaBar.OnChange += UpdateOcclusionColor;
        UIManager.Instance.staminaBar.OnChange += UpdateAwakenessBarFillColor;

        movementController = GameManager.Instance.GetMovementController();
    }
Exemplo n.º 38
0
    // Use this for initialization
    void Awake()
    {
        Debug.Log("Initialising " + versionNumber.text);
        assets = GetComponent <ChartEditorAssets>();
        selectedObjectsManager = new SelectedObjectsManager(this);
        sfxAudioStreams        = new LoadedStreamStore(soundMapConfig);

        _minPos = 0;
        _maxPos = 0;

        RegisterSystems();

        movement = GameObject.FindGameObjectWithTag("Movement").GetComponent <MovementController>();

        isDirty = false;

        gameObject.AddComponent <UITabbing>();

        windowHandleManager = new WindowHandleManager(versionNumber.text, GetComponent <Settings>().productName);
        errorManager        = gameObject.AddComponent <ErrorManager>();
        toolManager.Init();

        events.chartReloadedEvent.Register(OnChartReloaded);
    }
    new void Start()
    {
        base.Start();
        movement            = GetComponent <MovementController>();
        anim                = GetComponent <Animator>();
        movement.moveSpeed += Random.Range(-(movement.moveSpeed * 0.2f), movement.moveSpeed * 0.2f);
        chasing             = false;
        Transform    weaponSpot   = GetComponentInChildren <WeaponSpot>().transform;
        GearDatabase gearDatabase = GameObject.FindObjectOfType <GearDatabase>();
        GameObject   weap         = Instantiate(gearDatabase.weapons.Find(x => x.gamePref.name == startWeapon).gamePref, weaponSpot) as GameObject;

        weap.transform.localPosition = Vector3.zero;
        weap.transform.localRotation = Quaternion.identity;
        weap.transform.localScale    = Vector3.one;
        if (Random.Range(0, 10) > 5)
        {
            direction = 1;
        }
        else
        {
            direction = -1;
        }
        changeDirectionCooldown = Random.Range(2, 10);
    }
Exemplo n.º 40
0
 void Start()
 {
     player = GameObject.Find("Playable_Character");
     mc     = player.GetComponent <MovementController>();
     button = GetComponentInParent <Button>();
 }
 // Start is called before the first frame update
 void Start()
 {
     _movementController = GetComponent <MovementController>();
     _attachToPlane      = GetComponent <AttachToPlane>();
 }
Exemplo n.º 42
0
 public void JumpButton_Clicked()
 {
     MovementController.Jump(JumpPower);
 }
Exemplo n.º 43
0
 public AnimatedPlayer() : base()
 {
     CanWalk  = false;
     movement = new MovementController();
     Score    = 0;
 }
Exemplo n.º 44
0
 void Awake()
 {
     EventManager.AddListener(this,"GameOverEvent");
     EventManager.AddListener(this,"GameStartEvent");
     this.movementController = this.GetComponent<MovementController>();
 }
 // Use this for initialization
 void Start()
 {
     animator = GetComponent <Animator>();
     movement = player.GetComponent <MovementController>();
 }
Exemplo n.º 46
0
 public override void Awake()
 {
     base.Awake();
     _inputReader     = GameManager.Instance.playerInputReader;
     _movementControl = GetComponent <MovementController>();
 }
Exemplo n.º 47
0
	private UnitsController unitsController = null; //!< The local reference to the unit's controller
	#endregion

	#region Unity methods /// @name Unity methods
	/**
	 * Called when the script is loaded, before the game starts
	 */
	void Awake () {
		S = this;
	}
Exemplo n.º 48
0
 void Awake()
 {
     m_Controller = GetComponent<MovementController> ();
 }
Exemplo n.º 49
0
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* ------------------------------------ ACTION FUNCTIONS --------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    public IEnumerator Wander(MovementController ctr)
    {
        TurretController ltr = ctr as TurretController;

        yield return(ltr.Wander());
    }
Exemplo n.º 50
0
 public override void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex)
 {
     _rigidbody          = animator.GetComponent <Rigidbody2D>();
     _movementController = animator.GetComponent <MovementController>();
 }
Exemplo n.º 51
0
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* ------------------------------------ SCORERS FUNCTIONS -------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    /* --------------------------------------------------------------------------------------------*/
    public bool IsThereTargetAround(MovementController ctr)
    {
        // Declaration
        TurretController ltr;
        float            dist, min;
        int       count;
        Vector3   pos, dir, up;
        Collider  c;
        Transform tr;
        LayerMask mask;

        Collider[] colliderResults;

        // Initialization
        ltr             = ctr as TurretController;
        min             = float.MaxValue;
        up              = ltr.turret.transform.up;
        pos             = ctr.position;
        tr              = null;
        mask            = 1 << LayerMask.NameToLayer("Ground");
        colliderResults = Shared.colliderArray;
        count           = Physics.OverlapSphereNonAlloc(pos, this.turretData.rangeOfView, colliderResults, this.turretData.targetLayerMask);

        // Check
        for (int i = 0; i < colliderResults.Length && count > 0; ++i)
        {
            c = colliderResults[i];

            if (c == null)
            {
                continue;
            }

            // clean cache
            colliderResults[i] = null;

            // check if well-axed
            if (Mathf.Abs(ltr.turret.muzzle.InverseTransformPointUnscaled(c.transform.position).y) > 1f)
            {
                count--;
                continue;
            }

            // check if visible -> search wall/ground
            dir = c.transform.position - ltr.turret.muzzle.position;
            dir = Vector3.ProjectOnPlane(dir, up);
            if (Physics.Raycast(ltr.turret.muzzle.position, dir, dir.magnitude, mask))
            {
                count--;
                continue;
            }

            // check nearest target
            dist = Vector3.Distance(pos, c.transform.position);
            if (dist < min)
            {
                min = dist;
                tr  = c.transform;
            }

            count--;
        }

        ltr.target = tr;
        return(min <= this.turretData.rangeOfView);
    }
Exemplo n.º 52
0
 public void SetUp(Animator animator, int animationLayer, MovementController movementController)
 {
     anim = animator;
     layer = animationLayer;
     movement = movementController;
 }
    private void Start()
    {
        camera = GameObject.FindGameObjectWithTag("MainCamera"); //Find the camera
        CamControl = camera.GetComponent<CameraController>();
        hud = GameObject.FindGameObjectWithTag("HUD");
        player = GameObject.FindGameObjectWithTag("Player");

        GameObject notificationLog = GameObject.FindWithTag("Log");
        Log = notificationLog.GetComponent<LogScript>();

        movement_controller = GetComponent<MovementController>();
        weapon_backpack_controller = GetComponent<WeaponBackpackController>();
        healthController = GetComponent<HealthController>();
        RB = GetComponent<Rigidbody>();

        Flashlight = GetComponentInChildren<FlashlightController>();  //Attach the flashlight
        Particles = GetComponentsInChildren<ParticleSystem>();       //Attach the powerfists
        SetPowerfists(false);

        Drop = false;
        TrackFace = true;
        this.toggle_movement = false;

        ScreenSize = new Vector3(Screen.width, Screen.height);

        doubleTapCountdown = 0;
        //doubleTapCounts = new int[4];
        doubleTapCount = 0;
        //resetDoubleTapCount();
        dashDirection = new Vector2(0, 0);
        //dashCooldownCountdown = 0;
        this.isDashing = false;
        dashForceCurrent = 1;
        dashStartTime = 0;
        isStunned = false;
        stunCountdown = 0;
        SetStunElectricity(false);

        //currentFloor = 0;
        dialogueLevel = 0;
        deepestLevelVisited = 0;
        currLevel = 0;
        level = 0;

        defense = 1f;
    }
Exemplo n.º 54
0
	// Use this for initialization
	void Start () {
		_dScript = _dScript.GetComponent<DialogueScript>();
        _deshScript = _deshScript.GetComponent<DeshTutorial>();
        _pigScript = _pigScript.GetComponent<NewPigScript>();
        _movementScript = _movementScript.GetComponent<MovementController>();
        _waterWheel = _waterWheel.GetComponent<Animator>();
        _sawBlade = _sawBlade.GetComponent<Animator>();
        ArchuraAnim = ArchuraHimself.GetComponent<Animator>();
        jumpSequence.SetActive(false);
        _camera = _camera.GetComponent<Transform>();
        _dScript.hasDialogueEnd = true;
        _orignalRot = _camera.transform.rotation;
        
    }
Exemplo n.º 55
0
    public IEnumerator Shoot(MovementController ctr)
    {
        TurretController ltr = ctr as TurretController;

        yield return(ltr.Shoot());
    }
Exemplo n.º 56
0
 // Use this for initialization
 void Start()
 {
     controller = GetComponent<MovementController>();
     lastTarget = target;
     //self = transform;
     server.clients.Add(this);
     grid = server.grid;
     recentlyPerformance = GetComponent<PerformanceCalculator>();
     recentlyPerformance.AddPositions(transform.position);
     controller.setMovementSpeed(recentlyPerformance.getSpeed());
 }
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     this.animator                   = animator;
     movementController              = animator.GetComponent <MovementController>();
     movementController.OnJumpEnded += ResetAnimationState;
 }
    // Verify setup
    void Start()
    {
        Setup ();
            // Retry setup if references were cleared post-add

        if (target == null)
        {
            Debug.LogError ("No target assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        if (rigidbody == null)
        {
            Debug.LogError ("No rigidbody assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        if (jumpBoostVisuals == null)
        {
            Debug.LogError ("No jump boost visuals assigned. Please correct and restart.", this);
            enabled = false;
            return;
        }

        movementController = GetComponent<MovementController> ();
        movementController.onJump += OnJump;

        target[kRunForwardState].layer =
            target[kRunBackwardsState].layer =
            target[kStrafeLeftState].layer =
            target[kStrafeRightState].layer = 1;
        target.SyncLayer (1);
        target[kIdleState].layer = 1;
    }
Exemplo n.º 59
0
 public PlayerSprite() : base()
 {
     DirectionControl = DirectionControl.Rotational;
     movement         = new MovementController();
 }
 //
 // Use this for initialization
 void Start()
 {
     charClass = GetComponent<CharacterClass>();
     mControl = GetComponent<MovementController> ();
     iControl = GetComponent<InterfaceController> ();
     netview = mControl.netView;
     //	hitbox = hitboxObj.GetComponent<Collider> ();
 }