Inheritance: MonoBehaviour
    void Awake()
    {
        collisionData    = new List <CollisionData>();
        groundController = new GroundController(Walkable, this);

        currentlyClampedTo = null;
    }
示例#2
0
 public void ReplayOnClicked()
 {
     Debug.Log("REPLAY ON CLICKED : " + instance.gameState);
     ResetGame();
     GroundController.StartGame();
     Destroy(rb3d);
 }
示例#3
0
    private void OnShowing(int ratio, GroundController gc, int number)
    {
        switch (number)
        {
        case 1:
            gc.onShowingFst = null;
            break;

        case 2:
            gc.onShowingSec = null;
            break;

        case 3:
            gc.onShowingThr = null;
            break;
        }

        if (ratio == 25)
        {
            plusSpeed = ratio * 2;
        }
        else
        {
            plusSpeed = ratio * 4;
        }
        plusDamage += ratio;
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        while (runner != null && blockpointer < runner.transform.position.x + safeDistance)
        {
            int        planeIndex  = Random.Range(0, groundPlanePrefabs.Length);
            GameObject planeObject = GameObject.Instantiate <GameObject>(groundPlanePrefabs[planeIndex]);
            planeObject.transform.SetParent(this.transform);
            GroundController plane = planeObject.GetComponent <GroundController>();

            planeObject.transform.position = new Vector3(blockpointer + plane.groundPlaneSize / 2, 0, 0);

            blockpointer += plane.groundPlaneSize;
        }
        if (runner != null)
        {
            mainCamera.transform.position = new Vector3(runner.transform.position.x, mainCamera.transform.position.y, mainCamera.transform.position.z);
            text.text = "Score : " + Mathf.Floor(runner.transform.position.x);
        }
        else if (!isGameOver)
        {
            isGameOver = true;
            text.text += "\nPress P to Play Again";
        }
        if (Input.GetKeyDown("p"))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }
    }
    private void TouchDown(GroundController gc, bool isCover)
    {
        startGc = gc;
        if (charaIdx != null)
        {
            if (fightController.GetJob("P", (int)charaIdx) == 2)
            {
                startGc.onProtection = OnProtection;
            }

            charaGc.AddLast(startGc);
            if (isCover)
            {
                startCover = true;
                startGc.OnCover();
            }
            startGc.ChangeChara(fightController.GetJob("P", (int)charaIdx));

            startCharaImage = SetChess(startGc);
            endCharaImage   = SetChess(startGc);

            if ((int)gc.GetComponent <GroundController> ()._groundType == 99)
            {
                isResetGround = true;
            }
        }
    }
示例#6
0
    // Use this for initialization
    void Start()
    {
        Scene currentScene = SceneManager.GetActiveScene();

        sceneName = currentScene.name;
        theGround = FindObjectOfType <GroundController>();
    }
示例#7
0
        public PlayerController(PlayerCharacter player, PlayerData playerData, PlayerControls controls,
                                ControlSettings settings, AbstractController[] controllers)
        {
            this.player     = player;
            this.playerData = playerData;
            this.controls   = controls;
            this.settings   = settings;

            aerialController   = (AerialController)controllers[PlayerCharacter.ControllerIndexes.Air];
            groundController   = (GroundController)controllers[PlayerCharacter.ControllerIndexes.Ground];
            platformController = (PlatformController)controllers[PlayerCharacter.ControllerIndexes.Platform];
            wallController     = (WallController)controllers[PlayerCharacter.ControllerIndexes.Wall];
            ladderController   = (LadderController)controllers[PlayerCharacter.ControllerIndexes.Ladder];

            // TODO: Make this class reloadable.
            // Create buffers.
            var accessor = Properties.Access();
            var grab     = accessor.GetFloat("player.grab.buffer");
            var ascend   = accessor.GetFloat("player.ascend.buffer");

            // Actual values for requiresHold on each buffer are set when control settings are applied.
            attackBuffer = new InputBuffer(false, controls.Attack);
            grabBuffer   = new InputBuffer(grab, false, controls.Grab);
            ascendBuffer = new InputBuffer(ascend, false, controls.Jump);
            ascendBuffer.RequiredChords = controls.Ascend;

            settings.ApplyEvent += OnApply;

            MessageSystem.Subscribe(this, CoreMessageTypes.Input, (messageType, data, dt) =>
            {
                ProcessInput((FullInputData)data, dt);
            });
        }
 private void ResetStatus()
 {
     startCharaImage = null;
     endCharaImage   = null;
     startGc         = null;
     endGc           = null;
 }
    void Awake()
    {
        collisionData = new List<CollisionData>();
        groundController = new GroundController( Walkable, this );

        currentlyClampedTo = null;
    }
示例#10
0
    private void OnShowed(GroundController gc, int number)
    {
        switch (number)
        {
        case 1:
            gc.onShowedFst = null;
            break;

        case 2:
            gc.onShowedSec = null;
            break;

        case 3:
            gc.onShowedThr = null;
            break;
        }

        if (gc == seGrounds [seGrounds.Count - 1])
        {
            if (number == showNumber [showedCount - 1])
            {
                if (onRecycle != null)
                {
                    onRecycle.Invoke(this);
                }
                else
                {
                    Debug.Log("Null : " + seGrounds [0].name);
                }
            }
        }
    }
示例#11
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();
            GroundController groundController = (GroundController)target;

            if (GUILayout.Button("Randomize Terrain"))
            {
                groundController.Randomize();
                groundController.GenerateMap();
            }

            if (GUILayout.Button("Erode Terrain"))
            {
                foreach (int i in Enumerable.Range(0, 3))
                {
                    groundController.ErodeMap();
                }
            }


            if (GUILayout.Button("Generate Resources"))
            {
                groundController.GenerateResourcesAndDoodads();
            }
        }
    private void TouchDrap(GroundController gc, bool isCover)
    {
        GroundController checkGc = gc;

        Vector2 dir = ConvertDirNormalized(startGc.transform.localPosition, checkGc.transform.localPosition);

        if (IsCorrectDir(dir))
        {
            endGc = gc;

            if (isCover)
            {
                endCover = true;
                endGc.OnCover();
            }
            endGc.ChangeChara(fightController.GetJob("P", (int)charaIdx));

            if (fightController.GetJob("P", (int)charaIdx) == 2)
            {
                endGc.onProtection = OnProtection;
            }

            charaGc.AddLast(endGc);

            CheckGround(false);
            spaceCorrect = true;
        }
        else
        {
            TouchError();
        }
    }
    private void RoundEnd(bool hasDamage)
    {
        spCount++;

        completeSe = new List <GroundSEController> ();
        canAttack  = new List <int> ();

        ChangeStatus(FightStatus.FightStart);

        OnCloseButton(TargetType.All.ToString());

        ResetDamage(false);

        for (int i = 0; i < jobRatios.Length; i++)
        {
            if (jobRatios [i] != recJobRatios [i])
            {
                for (int j = 0; j < fightController.players.Length; j++)
                {
                    if (fightController.GetJob("P", j) == i)
                    {
                        AddCanAttack(j);
                        playerButton [j].SetRatioTxt(jobRatios [i], true);
                        playerButton[j].onComplete = RecycleShowUp;
                        unCompleteCount++;
                    }
                }
            }
        }

        recJobRatios = jobRatios;

        MonsterCdDown();


        if (hasDamage)
        {
            StartCoroutine(CheckRatio());
        }
        else
        {
            fightController.EnemyFight();
        }

        groundPool.RoundEnd();

        hasDamage       = false;
        spaceCount      = 0;
        charaIdx        = null;
        startCharaImage = null;
        endCharaImage   = null;
        startGc         = null;
        endGc           = null;
        ratioCount      = new int[5] {
            0, 0, 0, 0, 0
        };

        recAllRatioData = allRatioData;
    }
示例#14
0
    public void SetExtraData(GroundController start, GroundController end, ExtraType extraType)
    {
        Dictionary <GroundController, GroundController> link = new Dictionary <GroundController, GroundController>();

        link.Add(start, end);
        //Debug.Log (this.name + " : " + extraType);
        linkData.Add(extraType, link);
    }
示例#15
0
 public MovementController(string joystickName, int joystickID)
 {
     this.joystickID   = joystickID;
     this.joystickName = joystickName;
     airController     = new AirController(joystickID);
     groundController  = new GroundController(joystickID);
     waterController   = new WaterController(joystickID);
 }
示例#16
0
    // Use this for initialization
    void Start()
    {
        GameObject ground = GameObject.Find("ground");

        if (ground)
        {
            groundController = ground.GetComponent <GroundController>();
        }
    }
示例#17
0
 ///<summary>
 /// Get all components
 ///</summary>
 protected void GetComponents(Animator animator)
 {
     this.animator       = animator;
     body                = animator.gameObject.GetComponent <Rigidbody2D>();
     playerController    = animator.gameObject.GetComponent <PlayerController2D>();
     groundController    = animator.gameObject.GetComponent <GroundController>();
     ceilingController   = animator.gameObject.GetComponent <CeilingController>();
     climbableController = animator.gameObject.GetComponent <ClimbableController>();
 }
示例#18
0
    void Init()
    {
        init = false;

        GroundController groundController = ground.GetComponent <GroundController>();

        groundController.Init();
        groundController.StartGeneration();
    }
 void Start()
 {
     groundController    = GetComponentInChildren <GroundController>();
     ceilingController   = GetComponentInChildren <CeilingController>();
     leftWallController  = GetComponentInChildren <LeftWallController>();
     rightWallController = GetComponentInChildren <RightWallController>();
     frontWallController = GetComponentInChildren <FrontWallController>();
     backWallController  = GetComponentInChildren <BackWallController>();
 }
示例#20
0
 protected void AddCommonClasses()
 {
     freezeController                 = new FreezeController(freezePoints, freezeTime);
     playerHitTester                  = new PlayerHitTester(playerHitTesterRadius);
     groundController                 = new GroundController(transform, rayCheckingGroundLength, downRayCheckGroundMulti, standUpRaysMulti);
     healthController                 = new HealthController(healthPoints);
     attackClipEventHandler           = GetComponentInChildren <Animator>().gameObject.AddComponent <AttackClipEventHandler>();
     attackClipEventHandler.OnAttack += AttackHandler;
 }
示例#21
0
    // Use this for initialization
    void Start()
    {
        gameState = GameState.PreGame;

        // Make the GroundController
        GameObject tmp = (GameObject)Instantiate(p_groundController, new Vector3(0, 0, 0), transform.rotation);

        groundController = tmp.GetComponent <GroundController>();
        groundController.Init(this);
    }
示例#22
0
 // Start is called before the first frame update
 void Start()
 {
     _gasController    = GasController.Instance;
     _remController    = RemController.Instance;
     _carController    = CarController.Instance;
     _carBody          = CarBodyScript.Instance;
     _groundController = GroundController.Instance;
     GameOverPanel.SetActive(false);
     FinishPanel.SetActive(false);
 }
示例#23
0
    public void DoPlant(SeedData seed, GroundController ground)
    {
        int cost = seed.Cost;

        if (IsEnoughMoney(cost))
        {
            MoneyChange(-cost);
            ground.seedData = seed;
        }
    }
示例#24
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
示例#25
0
    void Start()
    {
        _player      = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
        _ground      = GetComponent <GroundController>();
        _soundPlayer = GetComponent <SoundPlayer>();

        _ground.BuildGround();

        _walkableBlocks = _ground.GetWalkableBlocks();
        SpawnEnemies();
    }
示例#26
0
 public void BuyGround(GroundController ground, int cost)
 {
     if (ground.status == 0)
     {
         if (IsEnoughMoney(cost))
         {
             MoneyChange(-cost);
             ground.GetBought();
         }
     }
 }
示例#27
0
 void Start()
 {
     if (instance != null)
     {
         Debug.LogError("There cannot be more than one instance of GroundController in the scene");
         Destroy(gameObject);
         return;
     }
     instance         = this;
     startGroundSpeed = groundSpeed;
     StartGame();
 }
 public void TriggerGc(GroundController gc, GameObject go)
 {
     if (go.CompareTag("CollisionStart"))
     {
         gc.OpenLight(GroundType.Copper, false);
     }
     else if (go.CompareTag("CollisionEnd"))
     {
         gc.CloseLight();
         collisionCount++;
     }
 }
示例#29
0
    void Awake()
    {
        lp_WorldContainer = GameObject.FindGameObjectWithTag("WorldContainer");

        if (this.gameObject != lp_WorldContainer)                                                                     //First make sure this isn't the WorldContainerObject
        {
            _levelName   = lp_CurLevelSection.name.Remove(0, 8);                                                      //remove unnesccary characters in the name
            lp_NextLevel = GameObject.Find("Level" + _levelName);                                                     //use the shortened name to find the next level
            lp_CurLevel  = this.transform.parent.gameObject;                                                          //find the current level the player is in
            this.transform.localScale = new Vector3(this.transform.localScale.x, 1f, this.transform.localScale.z);    //Set the proper scale in order to override prefabs
            this.GetComponent <BoxCollider2D>().size = new Vector2(this.GetComponent <BoxCollider2D>().size.x, 0.8f); //Set the proper size in order to ovveride prefabs
            this.gameObject.layer = LayerMask.NameToLayer("GroundPlus");                                              //Since we don't want the player flying through ground that should be solid we change the layer of these platforms

            this.GetComponent <BoxCollider2D>().enabled = false;                                                      //Disable the box collider of these platforms by default so the next level won't
            //spawn unless the player actually touches the top after the raycast turns the collider back on

            if (this.GetComponent <GroundController>() == null)           //Check to see if the script is already attached
            {
                GroundController grndControl = this.gameObject.AddComponent <GroundController>();
                //If the script is not attached then Attach it
            }

            GameObject RayStartPrefab = (GameObject)Resources.Load("PrefabsToLoad/RayLineStart", typeof(GameObject));
            GameObject RayEndPrefab   = (GameObject)Resources.Load("PrefabsToLoad/RayLineEnd", typeof(GameObject));

            //create RayStart and End
            GameObject rayStart = Instantiate(RayStartPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            rayStart.transform.parent = this.gameObject.transform;

            GameObject rayEnd = Instantiate(RayEndPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            rayEnd.transform.parent = this.gameObject.transform;

            lp_RayStartPrefab = rayStart.gameObject.transform;
            lp_RayEndPrefab   = rayEnd.gameObject.transform;

            this.GetComponent <GroundController>().grnd_BeginningOfRay = lp_RayStartPrefab;
            this.GetComponent <GroundController>().grnd_EndOfRay       = lp_RayEndPrefab;

            this.GetComponent <GroundController>().DelayedStart();            //Now that we're sure ALL the right variables are in all the right places
            //we use the Groundcontroller's start function
        }
        else         //This is the world container object
        {
            //lp_WorldContainer.GetComponent<SpawnControllerScript>().ActivateSpawners();
            //this.gameObject.GetComponent<SpawnControllerScript>().sc_CurLevel = lp_CurLevel;
            foreach (Transform child in transform)
            {
                lp_InactiveLevels.Add(child.gameObject);                                  //Add ALL Levels to the inactive list
            }
            lp_InactiveLevels.Remove(this.transform.FindChild("Level-Karat").gameObject); //take the first level out of the inactive
            lp_ActiveLevels.Add(this.transform.FindChild("Level-Karat").gameObject);      //and put it in the active
        }
    }
    /// <summary>
    /// Check if a tile should be highlighted and highlight it if so
    /// Only use on moveable tiles, uses a bfs search to get around corners and obstacles.
    /// </summary>
    /// <param name="tileCoords">coordinates of tile</param>
    private void CheckAndHighlightMoveableTile(Coords tileCoords)
    {
        BFS bfs = new BFS();

        if (HasPath(tileCoords, ref bfs, moveRange))
        {
            GroundController tile = _mapGenerator.GetTile(tileCoords);
            tile.SetHighlight(GroundController.HighlightType.Moveable);

            //add to highlighted tiles list
            _highlightedTiles.Add(tile);
        }
    }
示例#31
0
 private void OnCollisionEnter(Collision collision)
 {
     Debug.Log("Collided with:" + collision.collider.name);
     GroundController.Die();
     isAlive = false;
     SoundController.PlayDieSound();
     replayButton.SetActive(true);
     instance.gameState = GameState.death;
     if (points > highScore)
     {
         highScore = points;
         highSoreText.GetComponent <Text>().text = "Highscore: " + highScore;
     }
 }
示例#32
0
 private void SetSingleton()
 {
     if (Instance == null)
         Instance = this;
     else if (Instance != this)
         Destroy(gameObject);
 }