Inheritance: CharacterAttributes
	public CharacterBase(GameObject This)
	{
		characterObj = This;
		UpBody = This.transform.Find("UpBody").gameObject;
		DownCollider = This.transform.Find("DownCollider").gameObject;
		UpperAnim = This.transform.Find("UpBody/Upper").GetComponent<Animation>();
		FeetAnim = This.transform.Find("UpBody/Upper/Feet").GetComponent<Animation>();
		HeadSprite = This.transform.Find("UpBody/Upper/Head").GetComponent<SpriteRenderer>();
		BodySprite = This.transform.Find("UpBody/Upper/Body").GetComponent<SpriteRenderer>();
		characterAttributes = This.GetComponent<CharacterAttributes>();
		localEventManager = This.GetComponent<CharacterManager>().localEventManager;
		equipmentStatus = new EquipmentStatus("EmptyHand","Small"){Range=new Vector2(1,1)};
		characterStatus = new InAir(this,"Normal");
		characterStatus.Enter();
		EventManager.eventManager.DamageCheckEvent+=DamageCheck;
		localEventManager.ChangeToAirEvent+=ChangeToAir;
		localEventManager.ChangeToGroundEvent+=ChangeToGround;
		localEventManager.JumpEvent += Jump;
		localEventManager.MoveEvent += Move;
		localEventManager.AttackEvent += Attack;
		localEventManager.JumpLeftwardEvent += JumpLeftward;
		localEventManager.JumpRightwardEvent += JumpRightward;
		localEventManager.DodgeLeftwardEvent += DodgeLeftward;
		localEventManager.DodgeRightwardEvent += DodgeRightward;
		localEventManager.ThrowLeftwardEvent += ThrowLeftward;
		localEventManager.ThrowRightwardEvent += ThrowRightward;
		localEventManager.SpecialLeftwardEvent += SpecialLeftward;
		localEventManager.SpecialRightwardEvent += SpecialRightward;
	}
    // 캐릭터 스테이터스 표시.
    void DrawCharacterStatus(float x, float y, CharacterStatus status, Rect bar_rect, Color front_color)
    {
        // 이름.
        GUI.Label(
            new Rect(x, y, nameRect.width, nameRect.height),
            status.characterName,
            nameLabelStyle);

        float life_value = (float)status.HP / status.MaxHP;
        if(backLifeBarTexture != null)
        {
            // 후면 라이프바.
            y += nameRect.height;
            GUI.DrawTexture(new Rect(x, y, bar_rect.width, bar_rect.height), backLifeBarTexture);
        }

        // 전면 라이프바.
        if(frontLifeBarTexture != null)
        {
            float resize_front_bar_offset_x = frontLifeBarOffsetX * bar_rect.width / lifeBarTextureWidth;
            float front_bar_width = bar_rect.width - resize_front_bar_offset_x * 2;
            var gui_color = GUI.color;
            GUI.color = front_color;
            GUI.DrawTexture(new Rect(x + resize_front_bar_offset_x, y, front_bar_width * life_value, bar_rect.height), frontLifeBarTexture);
            GUI.color = gui_color;
        }
    }
Example #3
0
	public virtual void StartEffect(CharacterStatus ownerCS, int id)
	{
		effectIsActive = true;
		ID = id;
		owner = ownerCS;
		duration = statusEffect.effectDuration;
	}
Example #4
0
        // コンストラクタ
        public Character(Point nowPos, Size scope)
        {
            // キャラクターのステータスの初期化
            charaState = new CharacterStatus();

            // アクションステータスの初期化
            actionState = ActionStatus.FALL;

            // キャラクターイメージの初期化
            imageGroup = new CharaActionImage(charaState);

            // キャラクターの移動インスタンスの初期化
            charaMove = new CharaMove(this,scope);

            // 位置の設定
            this.position = nowPos;

            // アクションカウンターの初期化
            this.actionCounter = this.ACT_COUNTER_MAX;

            // タイマーの初期化
            timer = new Timers.StatusTimer();
            // タイマーのイベントハンドラの設定
            timer.Tick += new EventHandler(timerEvent);
            // タイマーのスタート
            timer.Enabled = true;
        }
Example #5
0
	public virtual void Awake()
	{
		controller=GetComponent<CharacterController>();
		characterVelocity = Vector3.zero;
		myStatus = GetComponent<CharacterStatus>();
		_myTransform = transform;
	}
Example #6
0
 // Use this for initialization
 void Start()
 {
     status = GetComponent<CharacterStatus>();
     charaAnimation = GetComponent<CharaAnimation>();
     inputManager = FindObjectOfType<InputManager>();
     gameRuleCtrl = FindObjectOfType<GameRuleCtrl>();
 }
Example #7
0
	void Awake()
	{
		capsule = GetComponent<CapsuleCollider>();
		grabTriggerCol = GetComponent<BoxCollider>();
		anim = GetComponent<Animator> ();
		_charStatus = GetComponent<CharacterStatus> ();
		_charAttacking = GetComponent<CharacterAttacking> ();
		_charAI = GetComponent<CharacterAI> ();
        if (!IsEnemy)
        {
            _playerInput = GetComponent<PlayerInput>();
            //_playerInputMobile = GetComponent<PlayerInputMobile>();
        }
		// I use these since when we have low health, we will move a bit slower.
		// When we get more than 25% health again, we will go back to our
		// default speeds for these.
		defaultAirSpeed = airSpeed;
		m_Loco_0Id = Animator.StringToHash ("Base Layer.Locomotion");
		m_Loco_1Id = Animator.StringToHash ("LowHealth.Locomotion");
		myRigidbody = GetComponent<Rigidbody> ();
		if (!grabTriggerCol)
			Debug.LogWarning("PLEASE ASSIGN YOUR Player's GRAB TRIGGER COLLIDER");
		else
			grabTriggerCol.enabled = false;
	}
Example #8
0
    public Character( StatExpressionsInfo statExpressions, CharacterPlanetPawn pawn, IInputSource inputSource, CharacterStatus status, CharacterStateController stateController, CharacterStateController weaponStateController, int teamId, CharacterInfo info )
    {
        this.statExpressions = statExpressions;
        this.status = status;
        this.health = new IntReactiveProperty( this.status.maxHealth.Value );
        this.pawn = pawn;
        this.inputSource = inputSource;
        this.stateController = stateController;
        this.weaponStateController = weaponStateController;
        this.teamId = teamId;
        this.info = info;
        this.inventory = new BasicInventory( this );

        pawn.SetCharacter( this );

        this.stateController.Initialize( this );
        this.weaponStateController.Initialize( this );

        var inputSourceDisposable = inputSource as IDisposable;
        if ( inputSourceDisposable != null ) {

            _compositeDisposable.Add( inputSourceDisposable );
        }

        Observable.EveryUpdate().Subscribe( OnUpdate ).AddTo( _compositeDisposable );
        status.moveSpeed.Subscribe( UpdatePawnSpeed ).AddTo( _compositeDisposable );
        health.Subscribe( OnHealthChange );//.AddTo( _compositeDisposable );

        instances.Add( this );
    }
Example #9
0
 public override void HitEnemy(CharacterStatus target)
 {
     //package up all attack data, damage + status effects etc
     //target.receiveHit(data);
     target.DealDamage(50);
     Debug.Log("hitenemy");
 }
Example #10
0
    void Start()
    {
        animator = GetComponent<Animator>();
        status = GetComponent<CharacterStatus>();

        prePosition = transform.position;
    }
    public int guardButtonPressed { get; private set; } // CharacterStatus accesses this when recovering from stun so we need it public.

    void Awake()
	{
		_anim = GetComponent<Animator> ();
		_charStatus = GetComponent<CharacterStatus> ();
		_charMotor = GetComponent<CharacterMotor>();
		_charAttacking = GetComponent<CharacterAttacking> ();
		_charItem = GetComponent<CharacterItem> ();
	}
Example #12
0
	// Use this for initialization
	public virtual void Start () {
	
		_myTransform = transform;
		myPhotonView = GetComponent<PhotonView>();
		myAvatar = GetComponent<Avatar>();
		myMotor = GetComponent<Motor>();
		myStatus = GetComponent<CharacterStatus>();
	}
Example #13
0
 public void UpdateTurn(GameObject character)
 {
     currentCharacter = character;
     Stats = currentCharacter.GetComponent<AttributesScript>();
     Abilities = currentCharacter.GetComponent<CharacterKnownAbilities>();
     Status = currentCharacter.GetComponent<CharacterStatus>();
     Character = currentCharacter.GetComponent<GenericControlsScript>();
 }
Example #14
0
   void Start() {

        isChangingCameras = false;
        scTransitionCamera = transitionCamera.GetComponent<TransitionCamera>();
        characterStatus = GameObject.FindGameObjectWithTag("CharacterStatus").GetComponent<CharacterStatus>();


    }
Example #15
0
	// Use this for initialization
	public override void InitialiseAISkill(CharacterStatus status, int skillIndex)
	{
		base.InitialiseAISkill(status, skillIndex);
		//currentAmmoCount = maxAmmoCount;
		AddPrefabToPool(bulletPrefab);
		AddPrefabToPool(projectileCollisionDecal);
		ResetSkill();
	}
Example #16
0
        // コンストラクタ
        public CharaActionImage(CharacterStatus characterStatus)
        {
            // イメージの初期化
            setBreedImage(characterStatus);

            // currentの初期値
            current = currentBreed.StopImage;
        }
Example #17
0
	void Awake()
	{
		_charStatus = GetComponent<CharacterStatus> ();
		_charMotor = GetComponent<CharacterMotor> ();
		_charItem = GetComponent<CharacterItem> ();
		anim = GetComponent<Animator> ();
		_myAgent = GetComponentInChildren<NavMeshAgent> ();
	}
	public void OnDespawned()
	{
		masterArmor = null;
		masterAISkill = null;
		status = null;
		pool = null;
		this.rigidbody.velocity = Vector3.zero;
	}
Example #19
0
 void Start()
 {
     playerCharacterStatus = FindObjectOfType<PlayerInput>().GetComponent<CharacterStatus>();
     playerCharacterStatus.Died += (isDead) => { gameObject.SetActive(isDead); };
     GetComponentInChildren<Text>().enabled = true;
     GetComponent<Image>().enabled = true;
     gameObject.SetActive(false);
 }
Example #20
0
	private void SetEnemy(Character chara,Vector3 pos,Vector3 dir,int camp,CharacterStatus.Pose pose,float speed,int life){
		chara.SetPos(pos);
		chara.SetDir(dir);
		chara.SetPose(pose);
		chara.SetCamp(camp);
		chara.SetSpeed(speed);
		//set bowman max life
		chara.SetLife(life);
	}
Example #21
0
    void Start()
    {
        status = transform.root.GetComponent<CharacterStatus>();

        // 오디오 초기화.
        hitSeAudio = gameObject.AddComponent<AudioSource>();
        hitSeAudio.clip = hitSeClip;
        hitSeAudio.loop = false;
    }
Example #22
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;
 }
Example #23
0
    public ContactSlot(int para_charID,
	                   CharacterStatus para_status,
	                   int para_numBioSectionsUnlocked,
	                   List<DifficultyMetaData> para_associatedDifficulties)
    {
        characterID = para_charID;
        status = para_status;
        numBioSectionsUnlocked = para_numBioSectionsUnlocked;
        album= new PhotoAlbum(para_charID,para_associatedDifficulties);
        enc = null;
    }
Example #24
0
    protected void Awake()
    {
        anim = GetComponent <Animator> ();
        audioSource = GetComponent <AudioSource> ();
        boneRig = GetComponentsInChildren<Rigidbody>();
        status = GetComponent<CharacterStatus>();
        floatingHealthBarSpawner = GetComponent<EnergyBarSpawnerUGUI>();

        maxHealth = status.MaxHealth;
        currentHealth = maxHealth;
    }
Example #25
0
	// Use this for initialization
	public virtual void InitialiseAISkill(CharacterStatus status, int skillIndex)
    {
		Debug.Log("initialising ai skill");
		usageCount = 0;
		ownerStatus = status;
		ownerManager = status.actionManager;
		ownerFSM = (SimpleFSM)ownerManager;
		ownerTransform = status._myTransform;
		ownerAnimation = ownerFSM.myAnimation;
		skillID = skillIndex;
		SetupAnimations();
		BasicSetup();
    }
	void Awake()
	{
		if (photonView.isMine)
		{
			this.enabled = false;   // due to this, Update() is not called on the owner client.
		}
		
		latestCorrectPos = transform.position;
		onUpdatePos = transform.position;

		_transform = transform;
		_motor = GetComponent<PlayerMotor>();
		myStatus = GetComponent<CharacterStatus>();
		actionManager = GetComponent<CharacterActionManager>();
	}
    IEnumerator Start()
    {
        status = GetComponent<CharacterStatus>();
        status.NowAngle = CharacterStatus.CharacterAngle.Left;
        status.NowState = (int)CharacterState.Moving;
        myRigidbody = GetComponent<Rigidbody>();
        myAnimation = GetComponent<Animation>();

        while (true)
        {
            // 3秒待機
            yield return new WaitForSeconds(3.0f);
            Instantiate(status.skillObject, new Vector3(transform.position.x + 2 * (int)status.NowAngle, transform.position.y + 2, transform.position.z), transform.rotation);
        }
    }
Example #28
0
        // キャラクターのアクションステータスに応じた画像を取得
        public CharaImage getImage(CharacterStatus characterStatus, ActionStatus actionStatus)
        {
            setBreedImage(characterStatus);

            switch(actionStatus){
                case ActionStatus.STOP:
                    current = currentBreed.StopImage;
                    break;
                case ActionStatus.WALK:
                    current = currentBreed.WalkImage;
                    break;
                default:
                    current = currentBreed.StopImage;
                    break;
            }
            return current;
        }
Example #29
0
	public Character() {
		state = CharacterState.Stand;
		status = new CharacterStatus();
		status.moveSpeed = 30f;
		status.regularMoveSpeed = 20f;
		type = 0;

		actionCds = new float[10];
		actionCdRemain = new float[10];

		for(int a=0;a!=10;++a)
			actionCds[a] = 0.3f;
		for(int a=0;a!=10;++a)
			actionCdRemain[a] = 0;

		passiveSkills = new ArrayList();
		tempEffects = new ArrayList();
	}
Example #30
0
 // キャラクターの種類に応じたイメージのセット
 public void setBreedImage(CharacterStatus characterStatus)
 {
     // 現在のキャラクターの種類をセット
     switch (characterStatus.Breed)
     {
         case "normal":
             currentBreed = normalImage;
             break;
         case "meet":
             currentBreed = meetImage;
             break;
         case "vegetable":
             currentBreed = vegImage;
             break;
         default:
             currentBreed = normalImage;
             break;
     }
 }
Example #31
0
 public void PostLoad()
 {
     _playerStats = GameManager.Inst.PlayerControl.SelectedPC.MyStatus;
 }
Example #32
0
 // Initialization.
 void Awake()
 {
     gameController  = GameObject.FindGameObjectWithTag("GameController");
     characterStatus = GetComponent <CharacterStatus>();
     lastPauser      = false;
 }
Example #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChatCommandHelpAttribute" /> class.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="argumentsType">Type of the arguments.</param>
 /// <param name="minimumCharacterStatus">The minimum character status.</param>
 public ChatCommandHelpAttribute(string command, Type?argumentsType, CharacterStatus minimumCharacterStatus)
 {
     this.Command                = command;
     this._argumentsType         = argumentsType;
     this.MinimumCharacterStatus = minimumCharacterStatus;
 }
Example #34
0
 // Use this for initialization
 void Start()
 {
     _status = FindObjectOfType <PlayerController>().GetComponent <CharacterStatus>();
     _text   = GetComponent <Text>();
 }
Example #35
0
 private void Awake()
 {
     Status = new CharacterStatus();
 }
Example #36
0
 protected void knockBack(Vector2 direction)
 {
     speed  = direction.normalized * nockBackForce;
     status = CharacterStatus.NOCK_BACK;
 }
Example #37
0
 public void GainEN(int who, CharacterStatus status, int en)
 {
     StartCoroutine(GraduallySetENBar(who, status, en, true, 10, 0.05f));
 }
Example #38
0
 private void UpdateCharacterStatus(CharacterStatus status, int teamNum)
 {
     status.teamNum = teamNum;
 }
Example #39
0
 void Start()
 {
     status = transform.root.GetComponent <CharacterStatus>();
 }
Example #40
0
 public virtual void OnDetach(CharacterStatus status)
 {
 }
Example #41
0
    IEnumerator GraduallySetENBar(int who, CharacterStatus status, int amount, bool isIncrease, int fillTimes, float fillDelay)
    {
        //Make sure to pick the correct character whose stats are changed
        Image           ENBar = null;
        TextMeshProUGUI ENVal = null;

        Debug.Log($"I am setting EN for {who}");

        switch (who)
        {
        case 0:
            ENBar = P1EN.transform.GetChild(0).gameObject.GetComponent <Image>();
            ENVal = P1EN.transform.GetChild(1).gameObject.GetComponent <TextMeshProUGUI>();
            break;

        case 1:
            ENBar = P2EN.transform.GetChild(0).gameObject.GetComponent <Image>();
            ENVal = P2EN.transform.GetChild(1).gameObject.GetComponent <TextMeshProUGUI>();
            break;

        case 2:
            ENBar = P3EN.transform.GetChild(0).gameObject.GetComponent <Image>();
            ENVal = P3EN.transform.GetChild(1).gameObject.GetComponent <TextMeshProUGUI>();
            break;

        default:
            Debug.LogError("A correct 'who' value was not provided");
            break;
        }

        //Finding the main percentage?
        float percentage   = 1 / (float)fillTimes;
        float targetEnergy = status.currEnergy + amount * (isIncrease ? 1 : -1);

        for (int fillStep = 0; fillStep < fillTimes; fillStep++)
        {
            //Taking part of the main percentage?
            float _fAmount = amount * percentage;
            float _dAmount = _fAmount / status.maxEnergy;

            //Debug.Log($"{_fAmount} {_dAmount}");

            if (isIncrease)
            {
                //Note - Be VERY CAREFUL here, I don't know how severe round to int can cause energy vs damage to go,
                //But SOMETHING is needed to prevent current energy from turning into a visual float.
                status.currEnergy += _fAmount;
                ENBar.fillAmount  += _dAmount;
                if (status.currEnergy <= status.maxEnergy)
                {
                    ENVal.SetText(Mathf.RoundToInt(status.currEnergy) + "/" + status.maxEnergy);
                }
            }
            else
            {
                status.currEnergy -= _fAmount;
                ENBar.fillAmount  -= _dAmount;
                if (status.currEnergy >= 0)
                {
                    ENVal.SetText(Mathf.RoundToInt(status.currEnergy) + "/" + status.maxEnergy);
                }
            }

            yield return(new WaitForSeconds(fillDelay));
        }
        status.currEnergy = targetEnergy;
        ENVal.SetText(status.currEnergy + "/" + status.maxEnergy);
    }
Example #42
0
 void Start()
 {
     inputData = GetComponent <InputData>();
     status    = GetComponent <CharacterStatus>();
 }
Example #43
0
    void Awake()
    {
        PlayerCtrl player_ctrl = (PlayerCtrl)GameObject.FindObjectOfType(typeof(PlayerCtrl));

        playerStatus = player_ctrl.GetComponent <CharacterStatus>();
    }
    public void CalculatePath()
    {
        Debug.Log(world == null ? "world is null" : "world is not null");
        walkableTiles      = world.GetWalkables();
        tileScores         = new float[world.WorldSize, world.WorldSize];
        DestinationReached = false; // resetting the destination reached to false
        Debug.Log($"CalculatePath : Working out path from {transform.position} to {Target}");
        for (int x = 0; x < tileScores.GetLength(0); x++)
        {
            for (int y = 0; y < tileScores.GetLength(1); y++)
            {
                tileScores[x, y] = -1f;
            }
            ;
        }
        ;                                                             // resetting the values
        tileScores[(int)Target.x, (int)Target.y] = 0;                 // setting the target square to 0
        AssignTileVals(new Vector2Int((int)Target.x, (int)Target.y)); // beginning the score assignment cycle

        Debug.Log("CalculatePath : Generated Tile Values");

        Vector2Int currentPos = new Vector2Int((int)transform.position.x, (int)transform.position.y); // work out what tile index the player is currently on
        float      currentVal = tileScores[currentPos.x, currentPos.y];                               // work out the current value of the tile index

        List <Vector3> movePointList = new List <Vector3>();
        int            lastTileX     = currentPos.x; // keeping track of the last tile in the path
        int            lastTileY     = currentPos.y;

        for (int i = (int)currentVal; i >= 0; i--)
        {
            #region Choosing tiles
            // pick which tile matches this value
            try
            {
                // checking left
                if (tileScores[lastTileX - 1, lastTileY] == i)
                {
                    movePointList.Add(new Vector3(lastTileX - 1, lastTileY, 0));
                    lastTileX -= 1;
                    continue; // finishes this iteration
                }
            }
            catch (IndexOutOfRangeException) { };
            try
            {
                // checking right
                if (tileScores[lastTileX + 1, lastTileY] == i)
                {
                    movePointList.Add(new Vector3(lastTileX + 1, lastTileY, 0));
                    lastTileX += 1;
                    continue;
                }
            }
            catch (IndexOutOfRangeException) { };
            try
            {
                // checking down
                if (tileScores[lastTileX, lastTileY - 1] == i)
                {
                    movePointList.Add(new Vector3(lastTileX, lastTileY - 1, 0));
                    lastTileY -= 1;
                    continue;
                }
            }
            catch (IndexOutOfRangeException) { };
            try
            {
                // checking up
                if (tileScores[lastTileX, lastTileY + 1] == i)
                {
                    movePointList.Add(new Vector3(lastTileX, lastTileY + 1, 0));
                    lastTileY += 1;
                    continue;
                }
            }
            catch (IndexOutOfRangeException) { };
            #endregion
        }

        MovePoints = movePointList;               // assigning the movepoints

        status = CharacterStatus.MovingAlongPath; // changing the current character status

        for (int i = 0; i < MovePoints.Count; i++)
        {
            MovePoints[i] += new Vector3(UnityEngine.Random.Range(-0.3f, 0.3f), UnityEngine.Random.Range(-0.3f, 0.3f), 0);
        }

        // used for debugging
        List <string> moveListString = new List <string>();
        foreach (Vector3 point in MovePoints)
        {
            moveListString.Add(point.ToString());
        }
        File.WriteAllLines("movelist.txt", moveListString.ToArray());


        List <string> linesToPrint = new List <string>();
        for (int y = 0; y < tileScores.GetLength(1); y++)
        {
            string line = "";
            for (int x = 0; x < tileScores.GetLength(0); x++)
            {
                line += $"{tileScores[x, y]},";
            }
            linesToPrint.Add(line);
        }
        File.WriteAllLines("path.csv", linesToPrint.ToArray());
    }
Example #45
0
    public void Move()
    {
        switch (status)
        {
        case CharacterStatus.IDLE:
        case CharacterStatus.WALK:
            if (status != CharacterStatus.ATTACK)
            {
                speed = speed * friction;
                if (Mathf.Abs(speed.x) <= 1)
                {
                    speed.x = 0;
                }
                if (Mathf.Abs(speed.y) <= 1)
                {
                    speed.y = 0;
                }
                if (speed.x == 0 && speed.y == 0)
                {
                    status = CharacterStatus.IDLE;
                }
                else
                {
                    CalculateDirection();
                    status = CharacterStatus.WALK;
                }
            }
            break;

        case CharacterStatus.ATTACK:
            speed.x = 0;
            speed.y = 0;
            break;

        case CharacterStatus.NOCK_BACK:
            speed = speed * nockBackFriction;
            if (Mathf.Abs(speed.x) <= 1)
            {
                speed.x = 0;
            }
            if (Mathf.Abs(speed.y) <= 1)
            {
                speed.y = 0;
            }
            if (speed.x == 0 && speed.y == 0)
            {
                status = CharacterStatus.IDLE;
            }
            else
            {
                CalculateDirection();
                status = CharacterStatus.NOCK_BACK;
            }
            break;

        default:
            break;
        }

        transform.Translate(speed * Time.deltaTime);
        AnimationControll();
    }
Example #46
0
 public void Initiolize(SampleController sampleController)
 {
     anim              = sampleController.anim;
     characterStatus   = sampleController.characterStatus;
     characterMovement = sampleController.characterMovement;
 }
Example #47
0
 public abstract void GetDeBuffInTime(BuffType debuff, float time, CharacterStatus status);
Example #48
0
    IEnumerator GraduallySetStatusBar(int who, CharacterStatus status, int amount, bool isIncrease, int fillTimes, float fillDelay)
    {
        //Make sure to pick the correct character whose stats are changed
        Image           HPBar = null;
        TextMeshProUGUI HPVal = null;

        switch (who)
        {
        case 0:
            HPBar = P1HP.transform.GetChild(0).gameObject.GetComponent <Image>();
            HPVal = P1HP.transform.GetChild(1).gameObject.GetComponent <TextMeshProUGUI>();
            break;

        case 1:
            HPBar = P2HP.transform.GetChild(0).gameObject.GetComponent <Image>();
            HPVal = P2HP.transform.GetChild(1).gameObject.GetComponent <TextMeshProUGUI>();
            break;

        case 2:
            HPBar = P3HP.transform.GetChild(0).gameObject.GetComponent <Image>();
            HPVal = P3HP.transform.GetChild(1).gameObject.GetComponent <TextMeshProUGUI>();
            break;

        default:
            Debug.LogError("A correct 'who' value was not provided");
            break;
        }

        //Finding the main percentage?
        float percentage   = 1 / (float)fillTimes;
        int   targetHealth = Mathf.RoundToInt(status.currHealth + amount * (isIncrease ? 1:-1));

        for (int fillStep = 0; fillStep < fillTimes; fillStep++)
        {
            //Taking part of the main percentage?
            float _fAmount = amount * percentage;
            float _dAmount = _fAmount / status.maxHealth;

            //Debug.Log($"{_fAmount} {_dAmount}");

            if (isIncrease)
            {
                //Note - Be VERY CAREFUL here, I don't know how severe round to int can cause health vs damage to go,
                //But SOMETHING is needed to prevent current health from turning into a visual float.
                status.currHealth += _fAmount;
                HPBar.fillAmount  += _dAmount;
                if (status.currHealth <= status.maxHealth)
                {
                    //HPVal.SetText(status.currHealth + "/" + status.maxHealth);
                    HPVal.SetText(Mathf.RoundToInt(status.currHealth) + "/" + status.maxHealth);
                }
            }
            else
            {
                status.currHealth -= _fAmount;
                HPBar.fillAmount  -= _dAmount;
                if (status.currHealth >= 0)
                {
                    HPVal.SetText(Mathf.RoundToInt(status.currHealth) + "/" + status.maxHealth);
                }
            }

            //For now, temporary fix like this

            /*if(fillStep == fillTimes - 1)
             * {
             *  status.currHealth = Mathf.RoundToInt(status.currHealth);
             *  //HPBar.fillAmount = Mathf.Round(HPBar.fillAmount);
             *  HPBar.fillAmount = Mathf.Round(HPBar.fillAmount*100)/100.0f;
             *  HPVal.SetText(status.currHealth + "/" + status.maxHealth);
             * }*/
            yield return(new WaitForSeconds(fillDelay));
        }
        status.currHealth = targetHealth;
        HPVal.SetText(status.currHealth + "/" + status.maxHealth);
    }
Example #49
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChatCommandHelpAttribute" /> class.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="minimumCharacterStatus">The minimum character status.</param>
 public ChatCommandHelpAttribute(string command, CharacterStatus minimumCharacterStatus)
     : this(command, null, minimumCharacterStatus)
 {
 }
Example #50
0
 public void SetCharacterStatus()
 {
     characterStatus = GameObject.FindWithTag("CharStatus").GetComponent <CharacterStatus>();
 }
Example #51
0
 void Start()
 {
     status    = GetComponent <CharacterStatus>(); //クラス内の変数(ステータス)を使えるようにする
     m_needExp = GetNeedExp(1);                    // 次のレベルに必要な経験値
 }
Example #52
0
 /// <summary>
 /// Initializes the MonoBehaviour
 /// </summary>
 void Start()
 {
     _targetSelector  = GetComponent <TargetSelector>();
     _characterStatus = GetComponent <CharacterStatus>();
     _agent           = GetComponent <NavMeshAgent>();
 }
 // Start is called before the first frame update
 void Start()
 {
     CharStat = this.transform.root.GetComponent <CharacterStatus>();
 }
Example #54
0
 public void SetCharacterStatus(CharacterStatus newStatus)
 {
     status = newStatus;
 }
Example #55
0
 private void OnTriggerEnter(Collider other)
 {
     targetstatus = GetTargerStatus(other);
     sellStatus   = GetSellStatus();
 }
Example #56
0
    void  Update()
    {
        CharacterStatus status = GetComponent <CharacterStatus>();

        if (Freeze || AttackDelay || Time.timeScale == 0.0f || status.Freeze)
        {
            //Cancel Charge
            if (Input.GetButtonUp("Fire1") && Charging || Input.GetKeyUp("j") && Charging)
            {
                Charging = false;
                if (ChargingEffect)
                {
                    Destroy(ChargingEffect.gameObject);
                }
            }
            return;
        }
        CharacterController controller = GetComponent <CharacterController>();

        if (status.IsFear)
        {
            Vector3 lui = transform.TransformDirection(Vector3.back);
            controller.Move(lui * 6 * Time.deltaTime);
            if (Input.GetButtonUp("Fire1") && Charging || Input.GetKeyUp("j") && Charging)
            {
                Charging = false;
                if (ChargingEffect)
                {
                    Destroy(ChargingEffect.gameObject);
                }
            }
            return;
        }
        if (MeleeForward)
        {
            Vector3 lui = transform.TransformDirection(Vector3.forward);
            controller.Move(lui * 3 * Time.deltaTime);
        }

        if (Input.GetButton("Fire1") && Time.time > NextFire && !IsCasting && !Charging || Input.GetKey("j") && Time.time > NextFire && !IsCasting && !Charging)
        {
            if (Time.time > (NextFire + 0.5f))
            {
                ComboIndex = 0;
            }
            //Attack Combo
            ConCombo++;
            if (controller.collisionFlags == CollisionFlags.None)
            {
                StartCoroutine(AttackCombo(JumpAttackPrefab));
            }
            else
            {
                StartCoroutine(AttackCombo(AttackPrefab));
            }

            //Charging Weapon if the Weapon can Charge and player hold the Attack Button
            if (CanCharge && !Charging && Time.time > NextFire / 2)
            {
                Charging = true;
                int index = Charge.Length - 1;
                while (index >= 0)
                {
                    Charge[index].CurrentChargeTime = Time.time + Charge[index].ChargeTime;
                    index--;
                }
            }
        }

        //Charging Effect
        if (Input.GetButton("Fire1") && Charging || Input.GetKey("j") && Charging)
        {
            int index = Charge.Length - 1;
            while (index >= 0)
            {
                if (Time.time > Charge[index].CurrentChargeTime)
                {
                    if (Charge[index].ChargeEffect && ChargingEffect != Charge[index].ChargeEffect)
                    {
                        if (!ChargingEffect || ChargeIndex != index)
                        {
                            if (ChargingEffect)
                            {
                                Destroy(ChargingEffect.gameObject);
                            }
                            ChargingEffect = Instantiate(Charge[index].ChargeEffect, transform.position, transform.rotation) as GameObject;
                            ChargingEffect.transform.parent = this.transform;
                            ChargeIndex = index;
                        }
                    }
                    index = -1;
                }
                else
                {
                    index--;
                }
            }
        }

        //Release Charging
        if (Input.GetButtonUp("Fire1") && Charging || Input.GetKeyUp("j") && Charging)
        {
            Charging = false;
            int index = Charge.Length - 1;
            if (ChargingEffect)
            {
                Destroy(ChargingEffect.gameObject);
            }
            while (index >= 0)
            {
                if (Time.time > Charge[index].CurrentChargeTime)
                {
                    //Charge Shot!!
                    if (Time.time > (NextFire + 0.5f))
                    {
                        ComboIndex = 0;
                    }
                    ConCombo = 1;
                    StartCoroutine(AttackCombo(Charge[index].ChargeAttackPrefab));
                    index = -1;
                }
                else
                {
                    index--;
                }
            }
        }

        if (Charging && !Input.GetKey("j") && !Input.GetButton("Fire1"))
        {
            Charging = false;
        }

        //Range
        if (Input.GetKeyDown("1") && !IsCasting && Skill[0].SkillPrefab)
        {
            SkillEquip = 0;
            Debug.Log("EQUIPED 1");
        }
        if (Input.GetKeyDown("2") && !IsCasting && Skill[1].SkillPrefab)
        {
            SkillEquip = 1;
            Debug.Log("EQUIPED 2");
        }
        if (Input.GetKeyDown("3") && !IsCasting && Skill[2].SkillPrefab)
        {
            SkillEquip = 2;
            Debug.Log("EQUIPED 3");
        }
        if (Input.GetButtonDown("Fire2") && Time.time > NextFire && !IsCasting && Skill[SkillEquip].SkillPrefab && !status.Blind || Input.GetKeyDown("i") && Time.time > NextFire && !IsCasting && Skill[SkillEquip].SkillPrefab && !status.Blind)
        {
            StartCoroutine(RangeSkill(SkillEquip));
        }

        //Stop Stand Attack Animation While Moving
        if (WhileAttack == WhileAttackState.WalkFree && IsCasting)
        {
            if (Input.GetButton("Horizontal") || controller.collisionFlags == CollisionFlags.None || GetComponent <MainPlayerController>().Dashing)
            {
                //TODO stop combo attack animation
            }
        }

        if (!GetComponent <MainPlayerController>().Dashing)
        {
            //TODO Stop Dashing Animation
        }
    }
Example #57
0
 // Initialization methods.
 void Awake()
 {
     characterStatus = GetComponent <CharacterStatus>();
 }
Example #58
0
 public void SetCharacter(GameObject character)
 {
     characterStatus = character.GetComponent <CharacterStatus>();
 }
Example #59
0
 public virtual void Update(CharacterStatus status)
 {
     RemainingTime = Mathf.Max(RemainingTime - Time.deltaTime, 0.0f);
 }
Example #60
0
 void Start()
 {
     playerInfo = this.gameObject.GetComponent <CharacterStatus>();
     StartCoroutine(State_Check());
 }