Inheritance: MonoBehaviour
Exemplo n.º 1
0
 public void Excute(CharacterMove t)
 {
     if (t.isStandingEnd)
     {
         t.stateMachine.ChangeState(StandState.GetInstance());
     }
 }
Exemplo n.º 2
0
    public void getFloorInfo(SpatialIndex.FLOOR_STATUS state)
    {
        if (CharacterMove.checkWithFloor((int)state, (int)SpatialIndex.FLOOR_STATUS.LAVA))
        {
            if (CheckIfChangeFloor((int)state))
            {
                changeColor.StartLerpColor(2, Color.red);
            }

            transform.localScale += Vector3.one * Time.deltaTime;
        }
        else if (CharacterMove.checkWithFloor((int)state, (int)SpatialIndex.FLOOR_STATUS.WATER))
        {
            if (CheckIfChangeFloor((int)state))
            {
                changeColor.StartLerpColor(1.2f, Color.blue);
            }


            if (transform.localScale.x >= 0.2f)
            {
                transform.localScale -= Vector3.one * Time.deltaTime / 4;
            }
        }
        else
        {
            if (CheckIfChangeFloor((int)state))
            {
                changeColor.StartLerpColor(1.3f, Color.yellow);
            }
        }
    }
    void FixedUpdate()
    {
        float         dt     = Time.fixedDeltaTime;
        Transform     camera = Camera.main.transform;
        CharacterMove mover  = GetComponent <CharacterMove>();

        mover.SetFaceAimRotation(Input.GetButton("Fire1") || Input.GetButton("Fire2"));
        mover.SetAimRotation(camera.rotation);
        mover.SetMoveDirection(new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical")));
        if (Input.GetButton("Jump"))
        {
            mover.Jump();
        }
        mover.DoMove();

        camVel              = (camVel + new Vector3(-Input.GetAxis("Mouse Y") * 50f * dt, Input.GetAxis("Mouse X") * 50f * dt, 0f)) * 0.8f;
        camera.eulerAngles += camVel;
        float camx = camera.eulerAngles.x;

        if (camx < 180f)
        {
            camx = Mathf.Min(camx, 60f);
        }
        else
        {
            camx = Mathf.Max(camx, 300f);
        }

        camera.eulerAngles = new Vector3(camx, camera.eulerAngles.y, camera.eulerAngles.z);
        camera.position    = Vector3.Lerp(camera.position, transform.position + new Vector3(0f, 3f, 0f) - camera.rotation * Vector3.forward * 6f, 0.5f);
    }
Exemplo n.º 4
0
 /// <summary>
 /// Called by any of <see cref="standardAttack"/>, <see cref="special1"/> or <see cref="special2"/>
 /// Uses <see cref="BattleManager.enemyMove"/> to decide on the enemy's move, and hides attack panel and makes
 /// attack button unclickable
 /// [EXTENSION] - If Gorilla, randomly swap to an attack that damages a team member 25% of the time
 /// </summary>
 private void prepareTurn()
 {
     if (!playerDied)                                                               //so long as the player has not just died, so a move should go ahead
     {
         if (player.Name == "Gorilla")                                              //if the player is the gorilla
         {
             if (Random.value <= 0.25)                                              //on a 25% chance
             {
                 Player alivePlayer = PlayerData.instance.data.getAlivePlayer();    //get an alive player
                 if (alivePlayer == null)                                           //if there is no other player alive
                 {
                     playerMove = new StandardAttack(manager, player, player);      //gorilla attacks themself
                 }
                 else                                                               //if there is at least one other player alive
                 {
                     playerMove = new StandardAttack(manager, player, alivePlayer); //attack that player
                 }
                 gorillaMove = true;                                                //signal that a gorilla move is occuring so sound effect can be played
             }
         }
         moveChosen = true;
         attacksPanel.SetActive(false);
         setButtonsInteractable(false);
         BattleButtons.panelActive = false;
     }
     else             //if player just died
                      //Perform the switch character move
     {
         StartCoroutine(performTurn(playerMove));
         playerDied = false;
         setButtonsInteractable(true);
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// Performs the turn, updating text display and health and magic bars.
    /// Afterwards, checks to see whether the player has won or lost
    /// </summary>
    /// <returns>Coroutine functions</returns>
    /// <param name="move">The move to  be performed</param>
    private IEnumerator performTurn(CharacterMove move)
    {
        int previousHealth = move.Target.Health;
        int previousMagic  = move.User.Magic;

        move.performMove();
        textBox.text = move.User.Name + " " + move.Text + " " + move.Target.Name;
        if (manager.WasCriticalHit && (move is StandardAttack || move is MagicAttack))
        {
            textBox.text += "\nCritical Hit!";
        }

        //Update bars and data
        if (move is SwitchPlayers)
        {
            updateToNewPlayer();
        }
        yield return(updateBars(move, previousHealth, previousMagic));

        if (move.Target is Enemy)
        {
            StartCoroutine(checkIfPlayerWon());
        }
        else
        {
            StartCoroutine(checkIfPlayerLost());
        }
    }
Exemplo n.º 6
0
    private void Awake()
    {
        m_rigidbody2D               = this.GetComponent <Rigidbody2D>();
        m_animFuntion               = this.transform.Find("PlayerSpineSprite").GetComponent <PlayerAnimFuntion>();
        m_attackCollider            = NormalAttackEffect.GetComponent <AttackCollider>();
        m_characterMove             = this.GetComponent <CharacterMove>();
        m_playerState               = this.GetComponent <PlayerState>();
        m_playerInput               = this.GetComponent <PlayerInput>();
        m_playerCrowdControlManager = this.GetComponent <PlayerCrowdControlManager>();
        m_randAudioFuntion          = this.GetComponent <PlayerRandAudioFuntion>();
        m_audioFuntion              = this.GetComponent <PlayerAudioFunction>();

        m_bAttacking = false;

        m_NormalAttackDic = new Dictionary <string, AttackInfo>();

        m_NormalAttackDic.Add("attack_1", new AttackInfo(1.0f, new Vector2(2.0f, 3f)));
        m_NormalAttackDic.Add("attack_2", new AttackInfo(1.0f, new Vector2(2.0f, 3f)));
        m_NormalAttackDic.Add("attack_3_1", new AttackInfo(0.5f, new Vector2(2.0f, 5.0f)));
        m_NormalAttackDic.Add("attack_3_2", new AttackInfo(2.0f, new Vector2(2.0f, -10.0f)));
        m_NormalAttackDic.Add("attack_4", new AttackInfo(3.0f, new Vector2(2.0f, 10.0f)));
        m_NormalAttackDic.Add("attack_5", new AttackInfo(4.0f, new Vector2(10.0f, 10.0f)));

        m_NormalAttackDic.Add("air_attack_1", new AttackInfo(1.0f, new Vector2(1f, 12f)));
        m_NormalAttackDic.Add("air_attack_2", new AttackInfo(1.0f, new Vector2(1f, 12f)));
        m_NormalAttackDic.Add("air_attack_3", new AttackInfo(1.0f, new Vector2(1f, 12f)));
        m_NormalAttackDic.Add("air_attack_4", new AttackInfo(1.0f, new Vector2(5f, 12f)));

        m_NormalAttackDic.Add("attack_upper", new AttackInfo(3.0f, new Vector2(1f, 24.0f)));
        m_NormalAttackDic.Add("attack_downsmash", new AttackInfo(4.0f, new Vector2(2f, -25.0f)));
    }
Exemplo n.º 7
0
Arquivo: Guard.cs Projeto: e2298/jam
 // Start is called before the first frame update
 void Start()
 {
     alertScript  = GetComponent <Alert>();
     patrolScript = GetComponent <Patrol>();
     mover        = GetComponent <CharacterMove>();
     lgth         = transform.Find("Point Light 2D");
 }
Exemplo n.º 8
0
 public void FixedUpdate(CharacterMove c)
 {
     if (isStableOnGround || canMoveInAir)
     {
         ApplyMoveFromInput(c);
     }
 }
Exemplo n.º 9
0
    private void Awake()
    {
        int count1 = 0;
        int count2 = 0;
        int count3 = 0;

        GameObject[] gameObjects = FindObjectsOfType <GameObject>();

        for (int j = 0; j < gameObjects.Length; ++j)
        {
            ReceiveDamage  receiveDamage  = gameObjects[j].GetComponent <ReceiveDamage>();
            AttackCollider attackCollider = gameObjects[j].GetComponent <AttackCollider>();
            CharacterMove  characterMove  = gameObjects[j].GetComponent <CharacterMove>();

            if (receiveDamage)
            {
                count1++;
            }

            if (attackCollider != null)
            {
                count2++;
            }

            if (characterMove)
            {
                count3++;
            }
        }

        Debug.Log("ReceiveDamage의 갯수: " + count1);
        Debug.Log("AttackCollider의 갯수: " + count2);
        Debug.Log("CharacterMove의 갯수: " + count3);
    }
 // Use this for initialization
 void Start()
 {
     pv = transform.root.GetComponent <PhotonView>();
     if (pv.isMine)
     {
         ps           = transform.root.GetComponent <PlayerState>();
         cm           = transform.root.GetComponent <CharacterMove>();
         HpBarObj     = Instantiate((GameObject)Resources.Load("SliderHP"), transform.position, transform.rotation) as GameObject;
         HangerBarObj = Instantiate((GameObject)Resources.Load("SliderHunger"), transform.position, transform.rotation) as GameObject;
         HpBarObj.transform.SetParent(transform);
         HangerBarObj.transform.SetParent(transform);
         HpBarSlider     = HpBarObj.GetComponent <Slider>();
         HangerBarSlider = HangerBarObj.GetComponent <Slider>();
         Transform SliderHpTr = transform.Find("SliderHpPos").gameObject.transform;
         HpBarObj.transform.position = new Vector3(SliderHpTr.position.x, SliderHpTr.position.y, SliderHpTr.position.z);
         HpBarObj.transform.rotation = new Quaternion(SliderHpTr.rotation.x, SliderHpTr.rotation.y, SliderHpTr.rotation.z, SliderHpTr.rotation.w);
         Transform SliderHungerTr = transform.Find("SliderHungerPos").gameObject.transform;
         HangerBarObj.transform.position = new Vector3(SliderHungerTr.position.x, SliderHungerTr.position.y, SliderHungerTr.position.z);
         HangerBarObj.transform.rotation = new Quaternion(SliderHungerTr.rotation.x, SliderHungerTr.rotation.y, SliderHungerTr.rotation.z, SliderHungerTr.rotation.w);
         RectTransform HpBarRect = HpBarObj.GetComponent <RectTransform>();
         HpBarRect.sizeDelta = new Vector2(Screen.width - 300.0f, 30);
         RectTransform HangerBarRect = HangerBarObj.GetComponent <RectTransform>();
         HangerBarRect.sizeDelta = new Vector2(Screen.width - 300.0f, 30);
     }
     else
     {
         this.enabled = false;
     }
 }
Exemplo n.º 11
0
    private void Start()
    {
        if (skinColor == SkinColors.random)
        {
            skinColor = (SkinColors)Random.Range(1, skinColors.Length);
        }
        RefreshSkinColor();
        if (politician)
        {
            Vector3 destination = GameObject.Find("HouseRegion").transform.position;
            moveController             = GetComponent <CharacterMove>();
            moveController.move.speed /= 2;
            moveController.move.SetAutoMovePosition(destination);

            var visual = transform.GetChild(0).GetChild(0).GetComponent <MeshRenderer>();
            UnityEngine.Assertions.Assert.IsNotNull(visual);

            var newMat = new Material(transform.GetChild(0).GetChild(0).GetComponent <MeshRenderer>().material);
            visual.material       = newMat;
            visual.material.color = judgeColor;

            //NS.Lines.MakeArrow(ref line, transform.position, destination, Color.black, 1, 1);
            Election.Instance.electors.Add(GetComponent <MaslowMeter>());
        }
    }
Exemplo n.º 12
0
    //Called by controller (AI or playercontrol)
    public void Attack(CharacterMove.IsoDirection dir)
    {
        //Initialise vector for grid position
        Vector2 newGridPos = Vector2.zero;

        //Determine new grid position based on direction
        if (dir == CharacterMove.IsoDirection.Up)
            newGridPos = new Vector2(characterMove.currentGridPos.x, characterMove.currentGridPos.y - 1);
        else if (dir == CharacterMove.IsoDirection.Down)
            newGridPos = new Vector2(characterMove.currentGridPos.x, characterMove.currentGridPos.y + 1);
        else if (dir == CharacterMove.IsoDirection.Left)
            newGridPos = new Vector2(characterMove.currentGridPos.x - 1, characterMove.currentGridPos.y);
        else if (dir == CharacterMove.IsoDirection.Right)
            newGridPos = new Vector2(characterMove.currentGridPos.x + 1, characterMove.currentGridPos.y);

        if (levelInfo.IsTileWalkable(newGridPos))
        {
            TileNode node = levelInfo.GetTile(newGridPos);

            //If this next tile is occupied
            if (node.isOccupied)
            {
                CharacterStats stats = node.occupyingGameObject.GetComponent<CharacterStats>();

                if (stats)
                    stats.RemoveHealth(10);

                //If this controller is that of the player, use a player turn
                if (characterMove.isPlayer)
                    GameManager.instance.UsePlayerTurn();
            }
        }
    }
Exemplo n.º 13
0
    private void Awake()
    {
        instance             = this;
        OnCheckpointDone     = null;
        OnParkourSwitchState = null;
        timerByCheckpoint    = new List <float>();
        player          = GameObject.FindGameObjectWithTag("Player");
        playerRigidbody = player.GetComponent <Rigidbody>();
        playerMovement  = player.GetComponent <CharacterMove>();
        cameraMove      = player.GetComponent <CameraMove>();

        checkpoints        = GameObject.FindObjectsOfType <CheckPoint>().OrderBy(checkpoint => checkpoint.index).ToList <CheckPoint>();
        startingCheckpoint = GameObject.FindObjectOfType <StartingCheckpoint>();
        lastPos            = player.transform.position;
        lastRotation       = player.transform.rotation;


        spectatingCamera = GameObject.Find("SpectatingCamera");
        if (!spectatingCamera)
        {
            spectatingCamera = GameObject.FindGameObjectWithTag("SpectatingCamera");
        }

        targetBuffer  = new List <Transform>();
        hitBuffer     = new List <Hit>();
        triggerBuffer = new List <ParkourTrigger>();
        targets       = new List <Transform>();
        hits          = new List <Hit>();
    }
Exemplo n.º 14
0
	// Use this for initialization
	void Awake ()
	{
		jumpScript = this.GetComponent<Jump> ();
		characterMoveScript = this.GetComponent<CharacterMove> ();
		characterMoveSpeed = characterMoveScript._Speed;
		jumpFallSpeed = jumpScript._FallSpeed;
	}
Exemplo n.º 15
0
    //行動対象の選択
    public void SelectStart(GameObject caster, Action ac)
    {
        //行動条件を満たしているか確認(MP等)
        if (!ac.IsCanAction(caster.GetComponent <Character>()))
        {
            Dialog.Dlog.SetText("MPが足りません");
            return;
        }

        action = ac;
        Target = new List <GameObject> ();

        Player = caster;
        CharacterMove CMove = caster.GetComponent <CharacterMove> ();

        GameController.Gcon.isCharacterSelect = true;
        if (action.isAoe())
        {
            StartCoroutine(AOEAction(CMove, ac));
            return;
        }

        //攻撃範囲の確認
        StartCoroutine(ActionRange.AR.AttackCost(CMove.nowPos [0], CMove.nowPos [1], action));
    }
Exemplo n.º 16
0
    IEnumerator absorbCharacter(CharacterMove character)
    {
        yield return StartCoroutine(character.walkToAndStop(new Vector2(transform.position.x, character.transform.position.y)));

        myAnimator.SetTrigger("isClosed");
        doorAnimator.SetTrigger("isClosed");

        //Disable this character's collider, so others will walk by.
        character.GetComponent<Collider2D>().enabled = false;
        character.GetComponent<Rigidbody2D>().gravityScale = 0;
        character.GetComponent<Rigidbody2D>().velocity = Vector2.zero;

        //Render the door over the character.
        doorRenderer.sortingLayerName = "Character";
        character.GetComponent<SpriteRenderer>().sortingLayerName = "Pre-Character";

        //Wait for animation to finish.
        yield return new WaitForSeconds(1.5f);

        MasterDriver.levelDriver.saveCharacter(character);

        //Destroy the character, render the door back again.
        DestroyImmediate(character.gameObject);
        doorRenderer.sortingLayerName = "Background Object";

        yield return new WaitForSeconds(1f);

        isTakingCharacter = false;
        yield return null;
    }
Exemplo n.º 17
0
    void MoveEnter(Character target, List <Vector2> path)
    {
        if (target == null || path.Count == 0)
        {
            return;
        }
        //Debug.Log(target + "認識");

        int[,] moveTo = new int[path.Count, 2];

        for (int i = 0; i < path.Count; i++)
        {
            moveTo[i, 0] = (int)path[i].x;
            moveTo[i, 1] = (int)path[i].y;
        }

        CharacterMove CMove = target.GetComponent <CharacterMove>();

        //StartCoroutine(CMove.PathMove(moveTo));
        delaydChar.Enqueue(CMove);
        delaydPath.Enqueue(moveTo);
        if (!isRunning)
        {
            StartCoroutine(DelaydMove());
        }
    }
Exemplo n.º 18
0
 //private void OnTouchSlides(Vector2 direction) { if(null != TouchSlides) { TouchSlides.Invoke(direction); } }
 //private void OnDoubleTap(int touchId, Direction side, Vector2 point) { if(null != DoubleTap) { DoubleTap.Invoke(touchId, side, point); } }
 private void OnCharacterMove(Vector2 direction)
 {
     if (null != CharacterMove)
     {
         CharacterMove.Invoke(direction);
     }
 }
Exemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     currentHealth = maxHealth;
     curMove = GameObject.Find("Cursor").GetComponent<CursorMovement>();
     charMove = gameObject.GetComponent<CharacterMove>();
     battleController = GameObject.Find("GameController").GetComponent<Battle>();
 }
Exemplo n.º 20
0
 /// <summary>
 /// Setup the second special move for the player
 /// [EXTENSION] - Log that a special move has been used
 /// </summary>
 public void special2()
 {
     QManagerObj.manager.logQuestVariable(questTypes.noSpecialMoves);          //log the special move use
     player.Special2.setUp(manager, player, enemy);
     playerMove = player.Special2;
     prepareTurn();
 }
Exemplo n.º 21
0
    /// <summary>
    /// Performs the turn, updating text display and health and magic bars.
    /// Afterwards, checks to see whether the player has won or lost
    /// </summary>
    /// <returns>Coroutine functions</returns>
    /// <param name="move">The move to  be performed</param>
    private IEnumerator performTurn(CharacterMove move)
    {
        int previousHealth = move.Target.Health;
        int previousMagic  = move.User.Magic;

        move.performMove();
        textBox.text = move.User.Name + " " + move.Text + " " + move.Target.Name;
        if (manager.WasCriticalHit && (move is StandardAttack || move is MagicAttack))
        {
            textBox.text += "\nCritical Hit!";
        }

        //If the player is a Gorilla it has a 50/50 chance of performing its move or attacking a team mate
        // ALL ADDED FOR ASSESSMENT 4
        if (move.User.GetType() == typeof(Player) && ((Player)move.User).IsGorilla)
        {
            SpecialMove damagePlayer = new MagicAttack("attacked a team mate", "Attack Team", 0, 30);
            List <int>  indexes      = new List <int>();

            bool badEffect = (Random.value > 0.5f);

            if (badEffect)
            {
                for (int i = 0; i < PlayerData.instance.data.Players.Length; i++)
                {
                    Player currentPlayer = PlayerData.instance.data.Players[i];
                    if (currentPlayer != null && !currentPlayer.IsGorilla)
                    {
                        indexes.Add(i);
                    }
                }

                int index = Random.Range(0, indexes.Count);
                index = indexes[index];

                Player[] players = PlayerData.instance.data.Players;
                damagePlayer.setUp(manager, move.User, players[index]);
                damagePlayer.performMove();

                textBox.text = move.User.Name + " " + move.Text + " " + move.Target.Name + " but Gorilla goes mad and hits " + damagePlayer.Target.Name + "!";
            }
        }

        //Update bars and data
        if (move is SwitchPlayers)
        {
            updateToNewPlayer();
        }
        yield return(updateBars(move, previousHealth, previousMagic));

        if (move.Target is Enemy)
        {
            StartCoroutine(checkIfPlayerWon());
        }
        else
        {
            StartCoroutine(checkIfPlayerLost());
        }
    }
Exemplo n.º 22
0
    public void BeginPathing(MeshCollider boundingRegion)
    {
        moveController = GetComponent <CharacterMove>();
        region         = boundingRegion;
        float timeBetweenPaths = UnityEngine.Random.Range(5, 10);

        InvokeRepeating("WalkTowardsSpotInRegion", 0, timeBetweenPaths);
    }
Exemplo n.º 23
0
 void Start()
 {
     animator    = GetComponent <Animator>();
     status      = GetComponent <CharacterStatus>();
     move        = FindObjectOfType <CharacterMove>();
     prePosition = transform.position;
     //prePosition.x = 140;
 }
Exemplo n.º 24
0
 protected virtual void initializeCapacities()
 {
     physics        = GetComponent <CharacterPhysics>();
     input          = GetComponent <CharacterInput>();
     move           = GetComponent <CharacterMove>();
     jump           = GetComponent <CharacterJump>();
     groundDetector = GetComponent <CharacterGroundDetection>();
 }
Exemplo n.º 25
0
    State nextState = State.Walking;            // 다음 스테이트.

    // Use this for initialization
    void Start()
    {
        status         = GetComponent <CharacterStatus>();
        charaAnimation = GetComponent <CharaAnimation>();
        characterMove  = GetComponent <CharacterMove>();
        basePosition   = transform.position;
        waitTime       = waitBaseTime;
    }
Exemplo n.º 26
0
    void Start()
    {
        this.player = GameObject.Find("player");



        cMove = player.GetComponent <CharacterMove>();
    }
 void Start()
 {
     if (pv.isMine)
     {
         om = GetComponent <OptionManager>();
         cm = GetComponent <CharacterMove>();
     }
 }
Exemplo n.º 28
0
 public void Excute(CharacterMove t)
 {
     if (Input.GetKeyDown(KeyCode.C))
     {
         t.animator.SetBool("IsCrouch", false);
         t.stateMachine.ChangeState(StandingState.GetInstance());
     }
 }
Exemplo n.º 29
0
 public void PlayerSpecialMove()
 {
     player.Special1.setUp(manager, player, enemy);
     playerMove = player.Special1;
     playerMove.performMove();
     //Should do 30 * 10 / 5 = 60 damage
     Assert.AreEqual(40, enemy.Health);
 }
Exemplo n.º 30
0
 private void Awake()
 {
     m_playerInput    = GetComponent <PlayerInput>();
     m_controlManager = GetComponent <PlayerCrowdControlManager>();
     m_playerInfo     = GetComponent <PlayerInfo>();
     m_characterMove  = GetComponent <CharacterMove>();
     m_animFuntion    = GetComponentInChildren <PlayerAnimFuntion>();
 }
Exemplo n.º 31
0
 public void Excute(CharacterMove t)
 {
     t.MoveDir = Vector3.zero;
     if (t.isCrouchingEnd)
     {
         t.stateMachine.ChangeState(CrouchState.GetInstance());
     }
 }
 void Start()
 {
     canDoDamage          = true;
     orbRend              = gameObject.GetComponent <Renderer>();
     orb_materials        = orbRend.materials;
     self_rigidbody       = gameObject.GetComponent <Rigidbody>();
     PlayerHealthSlider   = GameObject.FindGameObjectWithTag("PlayerHealth").GetComponent <Slider>();
     CharMoveOrbReference = GameObject.FindGameObjectWithTag("Player").GetComponent <CharacterMove>();
 }
Exemplo n.º 33
0
    public void ChangePlayer()
    {
        Player newPlayer = new Player("Second Player", 1, 1, 1, 1, 1, 1, 1, 1, 1, null, null, null);

        playerMove = new SwitchPlayers(manager, player, newPlayer);
        playerMove.performMove();
        Assert.AreEqual(newPlayer, manager.Player);   //Check player has been reassigned correctly
        Assert.False(manager.playerFirst());          //Check PlayerFirst has been updated
    }
Exemplo n.º 34
0
 void Start()
 {
     CharacterMove.instance = this;
     this.player            = GameObject.Find("player");
     this.LButton           = GameObject.Find("LButton");
     this.RButton           = GameObject.Find("RButton");
     this.UButton           = GameObject.Find("UButton");
     this.DButton           = GameObject.Find("DButton");
 }
Exemplo n.º 35
0
	public void saveCharacter(CharacterMove character)
    {
        savedCharacters++;
        requiredList.Remove(character);

        if (requiredList.Count == 0 && savedCharacters == charactersToSave)
        {
            EndLevel();
        }
    }
Exemplo n.º 36
0
 //public Text temp2;
 //public Text raw2;
 //public Text point2;
 void Start()
 {
     joystick = gameObject.transform.Find("Joystick").gameObject;
     joystickimg = joystick.GetComponent<Image>();
     player = FindObjectOfType<CharacterMove>();
     //nuppi = GetComponent<RectTransform>();
     //current.color = Color.clear;
     imgStartPosition = transform.position;
     //Debug.Log(player);
     //Debug.Log(imgStartPosition);
 }
Exemplo n.º 37
0
 // Use this for initialization
 void Start()
 {
     //gameController = GameObject.Find("GameController").GetComponent<GameController>();
     cursorSelection = GameObject.Find("Cursor").GetComponent<CursorSelection>();
     grid = GameObject.Find("Grid").GetComponent<GridWorld>();
     gameController = GameObject.Find("GameController").GetComponent<GameController>();
     //gridTile = null;
     charStatus = null;
     charMove = null;
     calculateAttackRange = false;
 }
Exemplo n.º 38
0
	void Start()
	{
		try
		{
			animator = transform.GetComponentInChildren<Animator>();						
		}
		catch(Exception e)
		{
			Debug.LogWarning("No animator attached to character." + e.Message);
		}

		characterMove = transform.GetComponent<CharacterMove>();
	}
Exemplo n.º 39
0
    void Start()
    {
        player = FindObjectOfType<CharacterMove> ();
        cam = FindObjectOfType<Camera> ();
        gText = GetComponent<GUITexture> ();
        gTextPad = transform.Find ("JoystickPad").GetComponent<GUITexture> ();
        insetYStart = cam.pixelHeight/4;
        insetXStart = cam.pixelWidth/4;
        insetWidth = insetYStart;
        insetHeight = insetYStart / 4;
        insetYRepair = insetHeight / 2;

        startVec = new Vector2 (insetXStart, insetYStart - insetYRepair);
        gText.pixelInset = new Rect(insetXStart, insetYStart - insetYRepair, 0f, insetHeight);
        gTextPad.pixelInset = new Rect(insetXStart - insetWidth / 2f,insetYStart - insetWidth / 2f,insetWidth,insetWidth);
        //gTextPad.pixelInset = new Rect(insetXStart + insetYRepair, insetYStart - insetYRepair, -insetYRepair*2, insetHeight);
        //gTextPad.transform.localScale = new Vector3 (2,2);
    }
Exemplo n.º 40
0
 void Start()
 {
     characterMove = GetComponent<CharacterMove>();
     levelInfo = GameManager.instance.levelInfo;
 }
Exemplo n.º 41
0
 public void setMove()
 {
     Move = Player.GetComponent<CharacterMove>();
 }
    // Use this for initialization
    void Start()
    {
        this.gameRuleCtrl = FindObjectOfType<GameRuleCtrl> ();
        this.status = GetComponent<CharacterStatus>();
        charaAnimation = GetComponent<CharaAnimation>();
        characterMove = GetComponent<CharacterMove>();

        basePosition = transform.position;
        waitTime = waitBaseTime;
    }
Exemplo n.º 43
0
 // Use this for initialization
 void Start()
 {
     status = GetComponent<CharacterStatus>();
     charaAnimation = GetComponent<CharaAnimation>();
     characterMove = GetComponent<CharacterMove>();
     gameRuleCtrl = FindObjectOfType<GameRuleCtrl>();
     // 초기 위치를 저장한다.
     basePosition = transform.position;
     // 대기 시간.
     waitTime = waitBaseTime;
 }
Exemplo n.º 44
0
    // Update is called once per frame
    void Update()
    {
        //if(cursorSelection.GetSelectedPlayerCharName() == gameObject.name)
        //{
        //    DebugAttMarPosList();
        //}
        //Debug.Log("calculateAttackRange: " + calculateAttackRange);
        if (gameController.GetDisplayTurnTextState() == false && gameController.GetPlayerTurnState() == true)
        {
            if (cursorSelection.GetSelectedPlayerCharName() == gameObject.name)
            {
                //Debug.Log(attMarkPosList.Count);
                if (calculateAttackRange == true)
                {
                    charStatus = GameObject.Find(cursorSelection.GetSelectedPlayerCharName()).GetComponent<CharacterStatus>();
                    charMove = GameObject.Find(cursorSelection.GetSelectedPlayerCharName()).GetComponent<CharacterMove>();
                    int attackRange = charStatus.GetAttackRange();

                    for (int i = 1; i <= attackRange; i++)
                    {
                        if (charMove.GetCurRow() - i >= 0)
                        {
                            Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow() - i].column[charMove.GetCurCol()].transform.position, Quaternion.identity);
                            AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                            attMarPos.row = charMove.GetCurRow() - i;
                            attMarPos.col = charMove.GetCurCol();
                            attMarkPosList.Add(attMarPos);
                        }

                        if (charMove.GetCurRow() + i < grid.row.Length)
                        {
                            Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow() + i].column[charMove.GetCurCol()].transform.position, Quaternion.identity);
                            AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                            attMarPos.row = charMove.GetCurRow() + i;
                            attMarPos.col = charMove.GetCurCol();
                            attMarkPosList.Add(attMarPos);
                        }

                        if (charMove.GetCurCol() - i >= 0)
                        {
                            Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow()].column[charMove.GetCurCol() - i].transform.position, Quaternion.identity);
                            AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                            attMarPos.row = charMove.GetCurRow();
                            attMarPos.col = charMove.GetCurCol() - i;
                            attMarkPosList.Add(attMarPos);
                        }

                        if (charMove.GetCurCol() + i < grid.row[charMove.GetCurRow()].column.Length)
                        {
                            Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow()].column[charMove.GetCurCol() + i].transform.position, Quaternion.identity);
                            AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                            attMarPos.row = charMove.GetCurRow();
                            attMarPos.col = charMove.GetCurCol() + i;
                            attMarkPosList.Add(attMarPos);
                        }
                    }

                    int counter = 1;
                    for (int j = 1; j <= attackRange; j++)
                    {
                        while (counter <= attackRange - j)
                        {
                            // Upper left
                            if (charMove.GetCurRow() - counter >= 0 && charMove.GetCurCol() - j > 0)
                            {
                                Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow() - counter].column[charMove.GetCurCol() - j].transform.position, Quaternion.identity);
                                AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                                attMarPos.row = charMove.GetCurRow() - counter;
                                attMarPos.col = charMove.GetCurCol() - j;
                                attMarkPosList.Add(attMarPos);
                            }

                            // Lower Left
                            if (charMove.GetCurRow() + counter < grid.row.Length && charMove.GetCurCol() - j > 0)
                            {
                                Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow() + counter].column[charMove.GetCurCol() - j].transform.position, Quaternion.identity);
                                AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                                attMarPos.row = charMove.GetCurRow() + counter;
                                attMarPos.col = charMove.GetCurCol() - j;
                                attMarkPosList.Add(attMarPos);
                            }

                            // Upper Right
                            if (charMove.GetCurRow() - counter >= 0 && charMove.GetCurCol() + j < grid.row[charMove.GetCurRow()].column.Length)
                            {
                                Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow() - counter].column[charMove.GetCurCol() + j].transform.position, Quaternion.identity);
                                AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                                attMarPos.row = charMove.GetCurRow() - counter;
                                attMarPos.col = charMove.GetCurCol() + j;
                                attMarkPosList.Add(attMarPos);
                            }

                            // Lower Right
                            if (charMove.GetCurRow() + counter < grid.row.Length && charMove.GetCurCol() + j < grid.row[charMove.GetCurRow()].column.Length)
                            {
                                Instantiate(Resources.Load("AttackMarker"), grid.row[charMove.GetCurRow() + counter].column[charMove.GetCurCol() + j].transform.position, Quaternion.identity);
                                AttackMarkerPosition attMarPos = new AttackMarkerPosition();
                                attMarPos.row = charMove.GetCurRow() + counter;
                                attMarPos.col = charMove.GetCurCol() + j;
                                attMarkPosList.Add(attMarPos);
                            }

                            counter++;
                        }
                    }
                    calculateAttackRange = false;
                }
            }
        }
    }
Exemplo n.º 45
0
    public bool OccupiedNearby(CharacterMove tarMove, GameObject theEnemy, string direction)
    {
        bool canUse = true;
        for (int i = 0; i < gameController.enemiesList.Count; i++)
        {
            EnemyMove enemyMove = GameObject.Find(enemyAI.GetEnemyCurrentlyTakingTurn().name).GetComponent<EnemyMove>();
            if(theEnemy == gameController.enemiesList[i])
            {
                continue;
            }

            if (direction == "up")
            {
                if (tarMove.GetCurRow() - 1 == enemyMove.GetCurRow() && tarMove.GetCurCol() == enemyMove.GetCurCol())
                {
                    canUse = false;
                }
            }
            else if (direction == "down")
            {
                if (tarMove.GetCurRow() + 1 == enemyMove.GetCurRow() && tarMove.GetCurCol() == enemyMove.GetCurCol())
                {
                    canUse = false;
                }
            }
            else if (direction == "left")
            {
                if (tarMove.GetCurRow() == enemyMove.GetCurRow() && tarMove.GetCurCol() - 1 == enemyMove.GetCurCol())
                {
                    canUse = false;
                }
            }
            else if (direction == "right")
            {
                if (tarMove.GetCurRow() == enemyMove.GetCurRow() && tarMove.GetCurCol() + 1 == enemyMove.GetCurCol())
                {
                    canUse = false;
                }
            }
        }
        return canUse;
    }
Exemplo n.º 46
0
 void Start()
 {
     playerMove = GetComponent<CharacterMove>();
 }
Exemplo n.º 47
0
 // Use this for initialization
 void Start()
 {
     status = GetComponent<CharacterStatus>();
     charaAnimation = GetComponent<CharaAnimation>();
     characterMove = GetComponent<CharacterMove>();
     // 초기 위치를 저장한다.
     basePosition = transform.position;
     // 대기 시간.
     waitTime = waitBaseTime;
 }
Exemplo n.º 48
0
 void Start()
 {
     Health = maxHealth;
     initialHealth = Health;
     characterMove = GetComponent<CharacterMove>();
     finishedMoving = CheckForTarget;
     characterMove.finishedMoving = finishedMoving;
     state = State.Idle;
     UpdateOverHead();
 }
Exemplo n.º 49
0
	public void removeCharacter(CharacterMove character)
	{
		character.transform.parent = null;
		heldCharacters.Remove(character);
        character.myWaitPlatform = null;

		//Sort the characters based on x position.
		heldCharacters.Sort(new posComparer());

		//Calculate the max distance from the starting platform we need.
		float maxDistance = -(spacePadding * (heldCharacters.Count - 1)) / 2f;

		//Move each character to their new position.
		for (int i = 0; i < heldCharacters.Count; i++)
		{
			heldCharacters[i].StopCoroutine("walkToAndStop");
			Vector2 myPlace = new Vector2(transform.position.x + maxDistance + (i * spacePadding), heldCharacters[i].transform.position.y);
			heldCharacters[i].StartCoroutine(heldCharacters[i].walkToAndStop(myPlace));
		}

	}
Exemplo n.º 50
0
 void Start()
 {
     healthmana = GetComponent<CharacterHealthMana> ();
     stats = GetComponent<CharacterStats> ();
     charEffects = GetComponent<CharacterEffects> ();
     move = GetComponent<CharacterMove> ();
     headTransform = transform.Find ("CharacterHead");
     handTransform = headTransform.Find ("LeftSpell");
     handParticles = handTransform.GetComponent<ParticleSystem> ();
 }
Exemplo n.º 51
0
 // Use this for initialization
 void Start()
 {
     charamove = gameObject.GetComponent<CharacterMove>();
     objectsource = gameObject.GetComponent<AudioSource>();
     boostTimer = 0f;
     isBoosting = false;
 }
Exemplo n.º 52
0
    // Use this for initialization
    void Start()
    {
        Data = gameObject.GetComponent<PlayerData>();

        if (OnAnim)
        {
            anim = GetComponent<Animator>();
            rig = GetComponent<Rigidbody2D>();
        }
        if (isMe)
        {
            Move = gameObject.GetComponent<CharacterMove>();
            Stamina = gameObject.GetComponent<StaminaScript>();

            // パラメータを1~5に調整
            Speed = MaxSetting(Speed);
            Boost = MaxSetting(Boost);
            Accel = MaxSetting(Accel);

            // 最高速度を変更
            SetSpeed(25f + 5f * Speed);
            // 加速までの時間を変更
            SetAccel(30 - 2 * Accel);
            // スタミナの最大値を変更
            Stamina.ChangeMax(500 + 100 * Boost);
        }
        // 三角アイコンの色を変更
        IconColor(GetPlayerNumber());
    }
Exemplo n.º 53
0
 //Optional regen
 //float healthRegen = 5.0f;
 void Start()
 {
     move = GetComponent<CharacterMove> ();
     health = maxHealth;
 }
Exemplo n.º 54
0
 public virtual void Initialize(CharacterParameterModel model)
 {
     this.characterMove = GetComponent<CharacterMove>();
     this.animationController = new AnimationController();
     animationController.SetAnimator(transform.FindChild("Model").GetComponent<Animator>());
     hud = transform.FindChild("HUD").GetComponent<CharacterHUD>();
     hud.InitHUD();
     InitCharacterParam (model);
     canMove = true;
     isInitialized = true;
     canDrag = true;
     ChangeState(ActionState.Idle);
 }
Exemplo n.º 55
0
 void Start()
 {
     stats = GetComponent<CharacterStats> ();
     move = GetComponent<CharacterMove> ();
 }