Exemplo n.º 1
0
    public void SaveTRObject()
    {
        MyStatus status = new MyStatus();

        status.myPosition = transform.position;
        trscript.PushTRObject(status);
    }
Exemplo n.º 2
0
    public void LoadTRObject(RObject robject)
    {
        MyStatus newStatus = (MyStatus)robject;

        velocity           = Vector2.zero;
        transform.position = newStatus.myPosition;
    }
Exemplo n.º 3
0
    [SerializeField] private MyStatus myStatus;                 //MyStatusスクリプト



    void Start()
    {
        characterController = GetComponent <CharacterController> ();            ///コンポネートを取得
        animator            = GetComponent <Animator> ();
        moveDirection       = Vector3.zero;                                     //ベクトルを初期化
        myStatus            = GetComponent <MyStatus>();
    }
Exemplo n.º 4
0
    public void LoadTROBject(TRObject trObject)
    {
        MyStatus status = trObject as MyStatus;

        transform.rotation = status.rotation;
        transform.position = status.position;
    }
    //fuer TimeReverse
    #region ITR implementation
    public void SaveTRObject()
    {
        MyStatus status = new MyStatus();

        status.myPosition = transform.position;
        //status.myRotation = transform.rotation;, gibts doch nicht, oder?
        trscript.PushTRObject(status);
    }
Exemplo n.º 6
0
    public void LoadTRObject(TRObject trobject)
    {
        MyStatus newStatus = (MyStatus)trobject;

        transform.position = newStatus.myPosition;
        //transform.rotation = newStatus.myRotation;
        this.GetComponent <Rigidbody2D>().isKinematic = true;
    }
	//fuer TimeReverse
	#region ITR implementation
	public void SaveTRObject ()
	{
		MyStatus status = new MyStatus();
		status.myPosition = transform.position;
		//status.myRotation = transform.rotation;, gibts doch nicht, oder?
		trscript.PushTRObject (status);

	}
Exemplo n.º 8
0
    Image fadeImage;         //透明度を変更するパネルのイメージ


    void Start()
    {
        FPSCon    = GameObject.Find("FPSController");
        img       = GetComponent <Image>();
        img.color = Color.clear;
        test      = GetComponent <MyStatus>();
        fadeImage = GetComponent <Image>();
    }
Exemplo n.º 9
0
    //fuer TimeReverse
    #region ITR implementation
    public void SaveTRObject()
    {
        MyStatus status = new MyStatus();

        status.myPosition = transform.position;
        //status.myRotation = transform.rotation;, gibts doch nicht, oder?
        trscript.PushTRObject(status);
        //this.GetComponent<Rigidbody2D>().isKinematic = false;
    }
Exemplo n.º 10
0
    //fuer TimeReverse
    #region ITR implementation
    public void SaveTRObject()
    {
        MyStatus status = new MyStatus();

        status.myPosition = transform.position;

        trscript.PushTRObject(status);
        //gameObject.GetComponent<Rigidbody2D>().isKinematic = false;
    }
Exemplo n.º 11
0
	//fuer TimeReverse
	#region ITR implementation
	public void SaveTRObject ()
	{
		MyStatus status = new MyStatus();
		status.myPosition = transform.position;
		//status.myRotation = transform.rotation;, gibts doch nicht, oder?
		trscript.PushTRObject (status);
		this.GetComponent<Rigidbody2D>().isKinematic = false;

	}
Exemplo n.º 12
0
	//fuer TimeReverse
	#region ITR implementation
	public void SaveTRObject ()
	{
		MyStatus status = new MyStatus();
		status.myPosition = transform.position;
	
		trscript.PushTRObject (status);
		//gameObject.GetComponent<Rigidbody2D>().isKinematic = false;

	}
Exemplo n.º 13
0
    public void LoadTRObject(TRObject trobject)
    {
        MyStatus newStatus = (MyStatus)trobject;

        transform.position = newStatus.myPosition;
        //transform.rotation = newStatus.myRotation;
        this.GetComponent <Rigidbody2D>().isKinematic        = true;
        gameObject.GetComponent <BoxCollider2D> ().enabled   = true;
        gameObject.GetComponent <BoxCollider2D> ().isTrigger = false;
    }
Exemplo n.º 14
0
    public void SaveTRObject()
    {
        MyStatus status = new MyStatus
        {
            rotation = transform.rotation,
            position = transform.position
        };

        timeReverse.PushTRObject(status);
    }
Exemplo n.º 15
0
    public void LoadTRObject(TRObject trobject)
    {
        MyStatus newStatus = (MyStatus)trobject;

        transform.position = newStatus.myPosition;
        //transform.rotation = newStatus.myRotation;
        gameObject.GetComponent <Rigidbody2D>().isKinematic = true;

        StartCoroutine(FallDown());
    }
Exemplo n.º 16
0
        public MyHPViewModel(
            MyStatus config,
            MyStatusModel model)
        {
            this.Config = config ?? this.GetConfig;
            this.Model  = model ?? MyStatusModel.Instance;

            this.RaisePropertyChanged(nameof(Config));
            this.RaisePropertyChanged(nameof(Model));

            this.Initialize();
        }
Exemplo n.º 17
0
    public virtual void SaveTRObject()
    {
        MyStatus status = new MyStatus();

        status.myPosition          = transform.position;
        status.myScale             = transform.localScale;
        enemyRigidbody.isKinematic = false;
        status.s            = state;
        status.l            = lives;
        status.ren          = gameObject.GetComponent <SpriteRenderer>().enabled;
        status.col          = gameObject.GetComponent <Collider2D>().enabled;
        status.runvelocity  = moveSettings.runVelocity;
        status.velocity     = velocity;
        status.LookingRight = lookingRight;
        trscript.PushTRObject(status);
    }
Exemplo n.º 18
0
    public virtual void LoadTRObject(RObject robject)
    {
        MyStatus newStatus = (MyStatus)robject;

        enemyRigidbody.isKinematic = true;
        transform.position         = newStatus.myPosition;
        transform.localScale       = newStatus.myScale;
        state = newStatus.s;
        lives = newStatus.l;
        gameObject.GetComponent <SpriteRenderer>().enabled = newStatus.ren;
        gameObject.GetComponent <Collider2D>().enabled     = newStatus.col;
        moveSettings.runVelocity = newStatus.runvelocity;
        vel.velocity             = newStatus.velocity;
        vel.pos      = newStatus.myPosition;
        lookingRight = newStatus.LookingRight;
    }
    private void dequeueAction()
    {
        Debug.Log("Dequeue!" + statusQueue.Count);
        MyStatus tmp = statusQueue.Dequeue();

        if (tmp.moveCount > 0)
        {
            moveCount    = tmp.moveCount;
            forwardSpeed = tmp.speed;
            moveMode     = 1;
        }
        else if (tmp.extraLoop == 1)
        {
            moveCount    = 1;
            moveMode     = 1;
            forwardSpeed = tmp.speed;
        }
    }
 public MyEntityViewModel(MyStatus status)
 {
     Status = status.ToString();
 }
Exemplo n.º 21
0
    public void LoadTRObject(TRObject trobject)
    {
        MyStatus newStatus = (MyStatus)trobject;

        transform.position = newStatus.myPosition;
    }
Exemplo n.º 22
0
 public MyMPViewModel(
     MyStatus config,
     MyStatusModel model) : base(config, model)
 {
 }
Exemplo n.º 23
0
    void Update()
    {
        CurrentAnimState.Update();

        _footStepTimer  += Time.deltaTime;
        _footStepTimeout = 0.1f;


        if (MyStatus.Health > 0)
        {
            UpdateLookDirection();

            UpdateDestBodyAngle();

            MyStatus.UpdateBodyStatusEveryone();
            if (MyStatus.Health <= 0)
            {
                MyStatus.Health = 0;
                OnDeath(Vector3.zero);
            }

            MyAI.AlwaysPerFrameUpdate();
        }

        bool isAlert = IsAlert();

        if (isAlert)
        {
            if (MyAnimator.GetInteger("AlertLevel") <= 1)
            {
                MyAnimator.SetInteger("AlertLevel", 2);
                //Debug.LogError("setting alert level to TWO");
            }
        }
        else
        {
            if (MyAnimator.GetInteger("AlertLevel") > 1)
            {
                MyAnimator.SetInteger("AlertLevel", 1);
                //Debug.LogError("setting alert level to ONE");
            }
        }

        if (ActionState == HumanActionStates.Twitch)
        {
            if (_twitchTimer > 0)
            {
                _twitchTimer -= Time.deltaTime;
            }
            else
            {
                _twitchTimer = 0;
                OnInjuryRecover();
            }
        }

        GoapAction action = MyAI.GetCurrentAction();

        if (action != null)
        {
            CurrentAction = action.Name;
        }
        else
        {
            CurrentAction = "NONE";
        }

        UpdateFading();
    }
Exemplo n.º 24
0
    public override bool SendDamage(Damage damage, Vector3 hitNormal, Character attacker, Weapon attackerWeapon)
    {
        OnInjury(hitNormal, damage.IsCritical);
        MyAI.Sensor.OnTakingDamage(attacker);

        float finalDamage = 0;

        if (damage.Type == DamageType.Bullet)
        {
            finalDamage = damage.KineticDamage;
        }
        else if (damage.Type == DamageType.Explosive)
        {
            finalDamage = damage.BlastDamage;
        }

        if (damage.IsCritical)
        {
            PlayVocal(VocalType.Injury);
            finalDamage *= 1.5f;
            if (this.Inventory.HeadSlot != null)
            {
                float armorRating = (float)this.Inventory.HeadSlot.GetAttributeByName("Armor").Value;
                float coverage    = (float)this.Inventory.HeadSlot.GetAttributeByName("Coverage").Value;
                float chance      = UnityEngine.Random.value;
                if (chance < coverage)
                {
                    //covered, calculate armor rating vs penetration
                    if (damage.Penetration >= armorRating)
                    {
                        //penetrated the armor
                        finalDamage = finalDamage * Mathf.Clamp01((damage.Penetration - armorRating) / armorRating);
                    }
                    else
                    {
                        //not penetrated
                        return(true);
                    }
                }
            }
        }
        else if (this.Inventory.ArmorSlot != null)
        {
            float armorRating = (float)this.Inventory.ArmorSlot.GetAttributeByName("Armor").Value;
            float coverage    = (float)this.Inventory.ArmorSlot.GetAttributeByName("Coverage").Value;
            float chance      = UnityEngine.Random.value;
            if (chance < coverage)
            {
                //covered, calculate armor rating vs penetration
                if (damage.Penetration >= armorRating)
                {
                    //penetrated the armor
                    finalDamage = finalDamage * Mathf.Clamp01((damage.Penetration - armorRating) / armorRating);
                }
                else
                {
                    //not penetrated
                    return(true);
                }
            }
            else
            {
                //uncovered area are less vulnerable. this does NOT apply to critical (head) hits.
                finalDamage *= 0.5f;
            }
        }


        if (finalDamage > 0 && damage.Bleeding > 0)
        {
            MyStatus.AddBleeding(damage.Bleeding);
        }

        MyStatus.Health -= finalDamage;

        DeathReason = damage.Type;

        if (MyStatus.Health <= 0)
        {
            MyStatus.Health = 0;
            OnDeath(hitNormal);
        }


        return(false);
    }
Exemplo n.º 25
0
    public override MeleeBlockType SendMeleeDamage(Damage damage, Vector3 hitNormal, Character attacker, float knockBackChance)
    {
        MyEventHandler.TriggerOnTakingHit();
        float attackerAngle = Vector3.Angle(transform.forward, transform.position - attacker.transform.position);

        if (ActionState == HumanActionStates.None && attackerAngle > 135 && UnityEngine.Random.value < 0.4f)
        {
            MyAnimator.SetTrigger("BlockSuccess");
            return(MeleeBlockType.SoftArmor);
        }
        else
        {
            OnInjury(hitNormal, UnityEngine.Random.value <= knockBackChance);
            MyAI.Sensor.OnTakingDamage(attacker);
            float finalDamage = damage.SharpDamage + damage.BluntDamage;

            if (damage.IsCritical)
            {
                finalDamage *= 1.5f;
            }

            if (this.Inventory.ArmorSlot != null)
            {
                float padding     = (float)this.Inventory.ArmorSlot.GetAttributeByName("Padding").Value;
                float armorRating = (float)this.Inventory.ArmorSlot.GetAttributeByName("Armor").Value;
                float coverage    = (float)this.Inventory.ArmorSlot.GetAttributeByName("Coverage").Value;
                float chance      = UnityEngine.Random.value;
                if (chance < coverage)
                {
                    //when hitting armor, only blunt damage applies
                    finalDamage = damage.BluntDamage - padding + damage.SharpDamage - armorRating;
                    if (finalDamage < 0)
                    {
                        finalDamage = 0;
                    }
                }
                else
                {
                    finalDamage = damage.SharpDamage + damage.BluntDamage;
                }
            }

            if (finalDamage > 0)
            {
                PlayVocal(VocalType.Injury);
            }

            if (finalDamage > 0 && damage.Bleeding > 0)
            {
                MyStatus.AddBleeding(damage.Bleeding);
            }

            MyStatus.Health -= finalDamage;
            DeathReason      = damage.Type;

            if (MyStatus.Health <= 0)
            {
                MyStatus.Health = 0;
                OnDeath(hitNormal);
            }
        }


        return(MeleeBlockType.NoBlock);
    }
Exemplo n.º 26
0
 public MyStatusEventArgs(String log, DateTime time, MyStatus c, String arg)
     : base(log, time)
 {
     this.Status   = c;
     this.Argument = arg;
 }
Exemplo n.º 27
0
    private MyStatus myStatus;                              //MyStatusスクリプト


    private void Start()
    {
        myStatus = transform.root.GetComponent <MyStatus>(); //ルートのオブジェクトのコンポネート(MyStatus)を取得
    }