Пример #1
0
        public void NewProperty(NewChanges changes)
        {
            UnitProperties pro = new UnitProperties();

            pro = this.properties;
            pro.isInitialized = changes.isInitialized;
            pro.teamFactionID = changes.teamFactionID;
            if (changes.heal > 0)
            {
                pro.currentHealth += changes.heal;
            }
            if (changes.damage > 0)
            {
                pro.currentHealth -= changes.damage;
            }
            if (pro.mouseTargetPosition != changes.mousePosition)
            {
                pro.oldMouseTargetPosition = pro.mouseTargetPosition;
                pro.mouseTargetPosition    = changes.mousePosition;
            }
            if (pro.enemySeenTargetPosition != changes.enemySeenPosition)
            {
                pro.oldEnemySeenTargetPosition = pro.enemySeenTargetPosition;
                pro.enemySeenTargetPosition    = changes.enemySeenPosition;
            }
            pro.isSelected        = changes.isSelected;
            pro.isSplitting       = changes.isSplitting;
            pro.isMerging         = changes.isMerging;
            pro.level             = changes.newLevel;
            pro.isCommanded       = changes.isCommanded;
            pro.isRecoveryEnabled = changes.isRecoveryEnabled;
            pro.targetUnit        = changes.targetUnit;

            //pro.currentHealth = (int) changes.newCurrentHealth;
            pro.maxHealth            = (int)changes.newMaxHealth;
            pro.attackFactor         = changes.newAttack;
            pro.speedFactor          = changes.newSpeed;
            pro.splitFactor          = changes.newSplit;
            pro.mergeFactor          = changes.newMerge;
            pro.attackCooldownFactor = changes.newAttackCooldown;


            pro.teamColor = changes.teamColor;
            Renderer renderer = this.GetComponent <Renderer>();

            renderer.material.SetColor("_TeamColor", changes.teamColor);

            pro.isAttackCooldownEnabled = changes.isAttackCooldownEnabled;
            OnPropertiesChanged(pro);
        }
Пример #2
0
 public void OnPropertiesChanged(UnitProperties pro)
 {
     this.properties = pro;
 }
Пример #3
0
        public void NewProperty(NewChanges changes)
        {
            UnitProperties pro = new UnitProperties();
            pro = this.properties;
            pro.isInitialized = changes.isInitialized;
            pro.teamFactionID = changes.teamFactionID;
            if (changes.heal > 0) {
                pro.currentHealth += changes.heal;
            }
            if (changes.damage > 0) {
                pro.currentHealth -= changes.damage;
            }
            if (pro.mouseTargetPosition != changes.mousePosition) {
                pro.oldMouseTargetPosition = pro.mouseTargetPosition;
                pro.mouseTargetPosition = changes.mousePosition;
            }
            if (pro.enemySeenTargetPosition != changes.enemySeenPosition) {
                pro.oldEnemySeenTargetPosition = pro.enemySeenTargetPosition;
                pro.enemySeenTargetPosition = changes.enemySeenPosition;
            }
            pro.isSelected = changes.isSelected;
            pro.isSplitting = changes.isSplitting;
            pro.isMerging = changes.isMerging;
            pro.level = changes.newLevel;
            pro.isCommanded = changes.isCommanded;
            pro.isRecoveryEnabled = changes.isRecoveryEnabled;
            pro.targetUnit = changes.targetUnit;

            //pro.currentHealth = (int) changes.newCurrentHealth;
            pro.maxHealth = (int) changes.newMaxHealth;
            pro.attackFactor = changes.newAttack;
            pro.speedFactor = changes.newSpeed;
            pro.splitFactor = changes.newSplit;
            pro.mergeFactor = changes.newMerge;
            pro.attackCooldownFactor = changes.newAttackCooldown;

            pro.teamColor = changes.teamColor;
            Renderer renderer = this.GetComponent<Renderer>();
            renderer.material.SetColor("_TeamColor", changes.teamColor);

            pro.isAttackCooldownEnabled = changes.isAttackCooldownEnabled;
            OnPropertiesChanged(pro);
        }
Пример #4
0
 public void OnPropertiesChanged(UnitProperties pro)
 {
     this.properties = pro;
 }